ng-ipa-library 1.4.5 → 1.4.6
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.
- package/esm2020/lib/core/interceptors/error.interceptor.mjs +24 -8
- package/esm2020/lib/models/apiResponse.mjs +1 -1
- package/fesm2015/ng-ipa-library.mjs +24 -8
- package/fesm2015/ng-ipa-library.mjs.map +1 -1
- package/fesm2020/ng-ipa-library.mjs +23 -7
- package/fesm2020/ng-ipa-library.mjs.map +1 -1
- package/lib/core/interceptors/error.interceptor.d.ts +3 -1
- package/lib/models/apiResponse.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1384,17 +1384,13 @@ class ErrorInterceptor {
|
|
|
1384
1384
|
};
|
|
1385
1385
|
switch (response.statusCode) {
|
|
1386
1386
|
case 500:
|
|
1387
|
-
|
|
1388
|
-
const toastr = this.toastrService.error(msg, response.message, toastrConfig);
|
|
1389
|
-
toastr.onShown.subscribe(() => {
|
|
1390
|
-
this.addCopyButton(response.message + '\n' + msg);
|
|
1391
|
-
});
|
|
1387
|
+
this.show500ErrorMsg(response, toastrConfig);
|
|
1392
1388
|
break;
|
|
1393
1389
|
default:
|
|
1394
|
-
this.
|
|
1390
|
+
this.showErrorMsg(response, toastrConfig);
|
|
1395
1391
|
break;
|
|
1396
1392
|
}
|
|
1397
|
-
return throwError(error);
|
|
1393
|
+
return throwError(() => error);
|
|
1398
1394
|
}));
|
|
1399
1395
|
}
|
|
1400
1396
|
isException(req) {
|
|
@@ -1405,6 +1401,26 @@ class ErrorInterceptor {
|
|
|
1405
1401
|
}
|
|
1406
1402
|
return false;
|
|
1407
1403
|
}
|
|
1404
|
+
showErrorMsg(response, toastrConfig) {
|
|
1405
|
+
if (response.errors && response.errors.length > 0) {
|
|
1406
|
+
toastrConfig.enableHtml = true;
|
|
1407
|
+
let msg = '';
|
|
1408
|
+
response.errors.forEach((error) => {
|
|
1409
|
+
msg += `<li>${error}</li>`;
|
|
1410
|
+
});
|
|
1411
|
+
this.toastrService.error(`<ul>${msg}</ul>`, response.message, toastrConfig);
|
|
1412
|
+
}
|
|
1413
|
+
else {
|
|
1414
|
+
this.toastrService.error('', response.message, toastrConfig);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
show500ErrorMsg(response, toastrConfig) {
|
|
1418
|
+
const msg = response.innerException + ' ' + (response.stackTrace ?? '');
|
|
1419
|
+
const toastr = this.toastrService.error(msg, response.message, toastrConfig);
|
|
1420
|
+
toastr.onShown.subscribe(() => {
|
|
1421
|
+
this.addCopyButton(response.message + '\n' + msg);
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1408
1424
|
addCopyButton(message) {
|
|
1409
1425
|
const messageToast = document.getElementsByClassName('toast-message')[0];
|
|
1410
1426
|
const icon = document.createElement('i');
|