Fix error with wrong debug info

This commit is contained in:
Selim Mustafaev 2021-01-12 23:45:58 +03:00
parent 420a46bd55
commit 3ea920d169

View File

@ -40,14 +40,14 @@ class Vin01Provider {
result.value = json.data;
return result;
} else {
return { status: 'rejected', reason: `[${json.data.status}] ${json.data.message}` };
return { status: 'rejected', reason: Error(`[${json.data.status}] ${json.data.message}`) };
}
} else {
result.value = json.data;
return result;
}
} else {
return { status: 'rejected', reason: `[${json.status}] ${json.code}` };
return { status: 'rejected', reason: Error(`[${json.status}] ${json.code}`) };
}
} else {
return result;
@ -62,8 +62,8 @@ class Vin01Provider {
let checks = [Vin01Provider.runCheck('base', vin, token), Vin01Provider.runCheck('history', vin, token)];
let [base, history] = (await Promise.allSettled(checks)).map(Vin01Provider.checkErrors);
if(base.status == 'rejected' && history.status == 'rejected') {
console.log('Vin01 base error: ', base.reason);
console.log('Vin01 history error: ', history.reason);
console.log('Vin01 base error: ', base.reason.message);
console.log('Vin01 history error: ', history.reason.message);
let vehicle = new Vehicle();
vehicle.vin1 = Utils.cyrillicToLatin(vin);
vehicle.debugInfo = {