-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Not all Errors are equal. #48
Conversation
index.js
Outdated
@@ -40,6 +40,10 @@ function isBuffer (x) { | |||
return true; | |||
} | |||
|
|||
function isError (x) { | |||
return x instanceof Error; |
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.
The main issue is that this won’t work across realms, and it will fail on an Error that has had its [[Prototype]] changed.
index.js
Outdated
@@ -66,6 +70,14 @@ function objEquiv(a, b, opts) { | |||
} | |||
return true; | |||
} | |||
if (isError(a)) { | |||
if (!isError(b)) { |
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.
this won’t work right if the first is not an error but the second is
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.
Rebased on top of #58, and preserved your unique test case.
Should fix #47