From 7b5c87796e135cee85b67f83f340aa0832ecae11 Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Thu, 1 May 2025 15:39:21 +0300 Subject: [PATCH] tb logging improvement --- addon/moch/torbox.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addon/moch/torbox.js b/addon/moch/torbox.js index d219512..b36b208 100644 --- a/addon/moch/torbox.js +++ b/addon/moch/torbox.js @@ -9,7 +9,7 @@ const KEY = 'torbox'; const timeout = 30000; const baseUrl = 'https://api.torbox.app/v1' -export async function getCachedStreams(streams, apiKey, ip) { +export async function getCachedStreams(streams, apiKey) { const hashBatches = chunkArray(streams.map(stream => stream.infoHash), 150) .map(hashes => getAvailabilityResponse(apiKey, hashes)); const available = await Promise.all(hashBatches) @@ -17,11 +17,10 @@ export async function getCachedStreams(streams, apiKey, ip) { .map(data => data.map(entry => entry.hash)) .reduce((all, result) => all.concat(result), [])) .catch(error => { + console.log('Failed TorBox cached torrent availability request: ', JSON.stringify(error.message || error)); if (toCommonError(error)) { return Promise.reject(error); } - const message = error.message || error; - console.log('Failed TorBox cached torrent availability request: ', JSON.stringify(message)); return undefined; }); return available && streams @@ -263,7 +262,7 @@ function getHeaders(apiKey) { export function toCommonError(data) { const error = data?.response?.data || data; - if (['AUTH_ERROR', 'BAD_TOKEN'].includes(error?.error)) { + if (['BAD_TOKEN'].includes(error?.error)) { return BadTokenError; } if (isAccessDeniedError(error)) {