@gricha/perry 0.1.0 → 0.1.1
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/dist/index.js +15 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -452,6 +452,21 @@ function handleError(err) {
|
|
|
452
452
|
else if (err instanceof Error) {
|
|
453
453
|
console.error(`Error: ${err.message}`);
|
|
454
454
|
}
|
|
455
|
+
else if (err && typeof err === 'object') {
|
|
456
|
+
const errObj = err;
|
|
457
|
+
if ('message' in errObj && typeof errObj.message === 'string') {
|
|
458
|
+
console.error(`Error: ${errObj.message}`);
|
|
459
|
+
}
|
|
460
|
+
else if ('code' in errObj) {
|
|
461
|
+
console.error(`Error: ${String(errObj.code)}`);
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
console.error(`Error: ${JSON.stringify(err)}`);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
else if (err !== undefined && err !== null) {
|
|
468
|
+
console.error(`Error: ${String(err)}`);
|
|
469
|
+
}
|
|
455
470
|
else {
|
|
456
471
|
console.error('An unknown error occurred');
|
|
457
472
|
}
|