From 96c8b300aa311a08535c49c77d121978caa2e0a4 Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Fri, 17 Jun 2022 22:04:56 +0300 Subject: [PATCH] fix offcloud error handling --- addon/moch/offcloud.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addon/moch/offcloud.js b/addon/moch/offcloud.js index c09dd5e..cd857fb 100644 --- a/addon/moch/offcloud.js +++ b/addon/moch/offcloud.js @@ -15,7 +15,7 @@ async function getCachedStreams(streams, apiKey) { .then(results => results.map(result => result.cachedItems)) .then(results => results.reduce((all, result) => all.concat(result), [])) .catch(error => { - if (error === 'badToken') { + if (error && error.error === 'NOAUTH') { return Promise.reject(BadTokenError); } console.warn('Failed Offcloud cached torrent availability request:', error); @@ -150,7 +150,7 @@ function statusReady(torrent) { } function errorExpiredSubscriptionError(error) { - return error['not_available'] != null; + return error && (error.includes('not_available') || error.includes('NOAUTH')); } module.exports = { getCachedStreams, resolve, getCatalog, getItemMeta }; \ No newline at end of file