mirror of
https://github.com/TheBeastLT/torrentio-scraper.git
synced 2026-04-20 01:42:03 +00:00
[scraper] print rd json error only when retries expired
This commit is contained in:
parent
2a50d5a8d7
commit
49e10f9c62
1 changed files with 6 additions and 3 deletions
|
|
@ -29,9 +29,12 @@ async function _getInstantAvailable(hashes, apiKey, retries = 3) {
|
|||
const RD = new RealDebridClient(apiKey, options);
|
||||
return RD.torrents.instantAvailability(hashes)
|
||||
.then(response => {
|
||||
if (typeof response !== 'object' && retries > 0) {
|
||||
console.warn('RD returned non JSON response: ', response);
|
||||
return _getInstantAvailable(hashes, apiKey, retries - 1);
|
||||
if (typeof response !== 'object') {
|
||||
if (retries > 0) {
|
||||
return _getInstantAvailable(hashes, apiKey, retries - 1);
|
||||
} else {
|
||||
return Promise.reject(new Error('RD returned non JSON response: ' + response));
|
||||
}
|
||||
}
|
||||
return response;
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue