Skip to content

Commit 55d07ae

Browse files
committed
support logging "duck typed" Error objects
1 parent 1bc9237 commit 55d07ae

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/utility.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) {
411411
break;
412412
case 'object':
413413
case 'array':
414-
if (arg instanceof Error || (typeof DOMException !== 'undefined' && arg instanceof DOMException)) {
414+
if (arg instanceof Error
415+
|| (typeof DOMException !== 'undefined' && arg instanceof DOMException)
416+
|| (typ === 'object' && arg.name && arg.message)) {
415417
err ? extraArgs.push(arg) : err = arg;
416418
break;
417419
}
@@ -429,7 +431,9 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) {
429431
custom ? extraArgs.push(arg) : custom = arg;
430432
break;
431433
default:
432-
if (arg instanceof Error || (typeof DOMException !== 'undefined' && arg instanceof DOMException)) {
434+
if (arg instanceof Error
435+
|| (typeof DOMException !== 'undefined' && arg instanceof DOMException)
436+
|| (typ === 'object' && arg.name && arg.message)) {
433437
err ? extraArgs.push(arg) : err = arg;
434438
break;
435439
}

0 commit comments

Comments
 (0)