bkper-js 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -28,7 +28,7 @@ export class HttpApiRequest extends HttpRequest {
|
|
|
28
28
|
return resp;
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
throw this.handleError(resp
|
|
31
|
+
throw this.handleError(resp);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
catch (error) {
|
|
@@ -48,10 +48,11 @@ export class HttpApiRequest extends HttpRequest {
|
|
|
48
48
|
yield HttpApiRequest.config.requestRetryHandler(errorResp.status, errorResp.data, this.retry);
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
|
-
console.log(`${errorResp.data} - Retrying... `);
|
|
51
|
+
console.log(`${JSON.stringify(errorResp.data)} - Retrying... `);
|
|
52
52
|
}
|
|
53
53
|
return yield this.fetch();
|
|
54
54
|
}
|
|
55
|
+
throw this.handleError(errorResp);
|
|
55
56
|
}
|
|
56
57
|
else if (error.request) {
|
|
57
58
|
// The request was made but no response was received
|
|
@@ -77,14 +78,14 @@ export class HttpApiRequest extends HttpRequest {
|
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
80
|
handleError(err) {
|
|
80
|
-
var _a, _b;
|
|
81
|
+
var _a, _b, _c;
|
|
81
82
|
const customError = HttpApiRequest.config.requestErrorHandler ? HttpApiRequest.config.requestErrorHandler(err) : undefined;
|
|
82
83
|
if (customError) {
|
|
83
84
|
return customError;
|
|
84
85
|
}
|
|
85
86
|
else {
|
|
86
87
|
//Default error handler
|
|
87
|
-
let error = (_b = (_a = err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error;
|
|
88
|
+
let error = ((_b = (_a = err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) || ((_c = err.data) === null || _c === void 0 ? void 0 : _c.error) || err.error;
|
|
88
89
|
if (error) {
|
|
89
90
|
return error.message;
|
|
90
91
|
}
|