Skip to content

[Breaking] ensure Error objects compare properly #58

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

Merged
merged 1 commit into from
Aug 10, 2019

Conversation

khirayama
Copy link
Contributor

@khirayama khirayama commented Apr 18, 2018

I tried to support Error object. It is easy to cover almost all cases.
But it is too difficult to make sure that supporting current supported browsers and nodejs.

Refs:


I felt we should avoid to support to compare Error objects.
We might better to put some comments on README.md about that.


Fixes #47.
Almost same solution: #48

index.js Outdated
@@ -40,6 +40,10 @@ function isBuffer (x) {
return true;
}

function isError(value) {
return value instanceof Error;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't work cross-realm, i'm afraid.

@ljharb ljharb force-pushed the feature/support-errors branch from eaa2992 to bffc3d3 Compare July 31, 2019 06:14
@@ -59,6 +59,13 @@ function objEquiv(a, b, opts) {

if (isArguments(a) !== isArguments(b)) { return false; }

var aIsError = a instanceof Error;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebased and tweaked; here's where this isn't a reliable cross-realm check.

@ljharb ljharb changed the title Support to compare Error objects [Breaking] ensure Error objects compare properly Jul 31, 2019
@ljharb ljharb force-pushed the feature/support-errors branch from bffc3d3 to ffb2522 Compare August 9, 2019 20:09
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to get this in anyways, despite the lack of a cross-realm brand check.

@ljharb ljharb merged commit ffb2522 into inspect-js:master Aug 10, 2019
@khirayama khirayama deleted the feature/support-errors branch August 11, 2019 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Two different Errors are considered equal
2 participants