diff --git a/addon/moch/alldebrid.js b/addon/moch/alldebrid.js index 9b4c8e6..a32d9b1 100644 --- a/addon/moch/alldebrid.js +++ b/addon/moch/alldebrid.js @@ -81,7 +81,7 @@ async function resolve({ ip, apiKey, infoHash, cachedEntryInfo, fileIndex }) { console.log(`Access denied to AllDebrid ${infoHash} [${fileIndex}]`); return StaticResponse.FAILED_ACCESS; } - return Promise.reject(`Failed AllDebrid adding torrent ${error}`); + return Promise.reject(`Failed AllDebrid adding torrent ${JSON.stringify(error)}`); }); } @@ -102,11 +102,7 @@ async function _resolve(AD, infoHash, cachedEntryInfo, fileIndex) { async function _createOrFindTorrent(AD, infoHash) { return _findTorrent(AD, infoHash) - .catch(() => _createTorrent(AD, infoHash)) - .catch(error => { - console.warn('Failed AllDebrid torrent retrieval', error); - return error; - }); + .catch(() => _createTorrent(AD, infoHash)); } async function _retryCreateTorrent(AD, infoHash, encodedFileName, fileIndex) { diff --git a/addon/moch/realdebrid.js b/addon/moch/realdebrid.js index 0c46227..7a0bde1 100644 --- a/addon/moch/realdebrid.js +++ b/addon/moch/realdebrid.js @@ -82,7 +82,13 @@ async function getCatalog(apiKey, offset = 0) { .then(nextTorrents => torrents.concat(nextTorrents)) .catch(() => torrents) : torrents) - .then(torrents => torrents && torrents.length ? torrents : []) + .then(torrents => { + if (Array.isArray(torrents)) { + return torrents; + } + console.log(`Received non array response for RealDebrid catalog: `, torrents) + return []; + }) .then(torrents => torrents .filter(torrent => statusReady(torrent.status)) .map(torrent => ({