[HD] Fix crashing issue in certain circumstances

Fixes a crashing issue when an API request fails with specific types of errors (such as ECONNRESET)
This commit is contained in:
AnimeDL 2024-05-30 09:53:19 -07:00
parent 6275d5abe3
commit be95c1f3bc

View file

@ -152,7 +152,7 @@ export default class Hidive implements ServiceClass {
};
let apiReq = await this.req.getData(options.url, apiReqOpts);
if(!apiReq.ok || !apiReq.res){
if (apiReq.error && apiReq.error.res.statusCode == 401) {
if (apiReq.error && apiReq.error.res?.statusCode == 401) {
console.warn('Token expired, refreshing token and retrying.');
if (await this.refreshToken()) {
if (authType == 'other') {