[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:
parent
6275d5abe3
commit
be95c1f3bc
1 changed files with 1 additions and 1 deletions
|
|
@ -152,7 +152,7 @@ export default class Hidive implements ServiceClass {
|
||||||
};
|
};
|
||||||
let apiReq = await this.req.getData(options.url, apiReqOpts);
|
let apiReq = await this.req.getData(options.url, apiReqOpts);
|
||||||
if(!apiReq.ok || !apiReq.res){
|
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.');
|
console.warn('Token expired, refreshing token and retrying.');
|
||||||
if (await this.refreshToken()) {
|
if (await this.refreshToken()) {
|
||||||
if (authType == 'other') {
|
if (authType == 'other') {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue