-
Couldn't load subscription status.
- Fork 215
support logging "duck typed" Error objects #915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,8 +139,10 @@ function isIterable(i) { | |
| * @returns true if e is an error | ||
| */ | ||
| function isError(e) { | ||
| // Detect both Error and Firefox Exception type | ||
| return isType(e, 'error') || isType(e, 'exception'); | ||
| // Detect Error, Firefox Exception type and error like object | ||
| return (isType(e, 'error') | ||
| || isType(e, 'exception') | ||
| || (typeof e === 'object' && e && e.name && e.message)); | ||
| } | ||
|
|
||
| function redact() { | ||
|
|
@@ -410,7 +412,7 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) { | |
| break; | ||
| case 'object': | ||
| case 'array': | ||
| if (arg instanceof Error || (typeof DOMException !== 'undefined' && arg instanceof DOMException)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in my browser |
||
| if (isError(arg)) { | ||
| err ? extraArgs.push(arg) : err = arg; | ||
| break; | ||
| } | ||
|
|
@@ -428,7 +430,7 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) { | |
| custom ? extraArgs.push(arg) : custom = arg; | ||
| break; | ||
| default: | ||
| if (arg instanceof Error || (typeof DOMException !== 'undefined' && arg instanceof DOMException)) { | ||
| if (isError(arg)) { | ||
| err ? extraArgs.push(arg) : err = arg; | ||
| break; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not save the
typeNameand move the comparisons inline because of this #915 (comment)