Skip to content
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

JSError: never fail with invalid getter target" #1621

Closed
wants to merge 1 commit into from

Conversation

tmikov
Copy link
Contributor

@tmikov tmikov commented Feb 17, 2025

Summary:
JS developers expect this to work and print "undefined":

function MyEror() {
    this.message = "MyError";
}
MyError.prototype = Object.create(Error.prototype);
try {
    throw new MyError();
} catch (e) {
    print(e.stack);
}

We give it to them by preventing the getter from throwing errors. In V8
this is implemented differently by attaching the getter to the actual
instance.

Arguably, this makes sense.

Add and update tests.

  • Grafted path static_h to hermes

Differential Revision: D69757360

Summary:
JS developers expect this to work and print "undefined":
```js
function MyEror() {
    this.message = "MyError";
}
MyError.prototype = Object.create(Error.prototype);
try {
    throw new MyError();
} catch (e) {
    print(e.stack);
}
```

We give it to them by preventing the getter from throwing errors. In V8
this is implemented differently by attaching the getter to the actual
instance.

Arguably, this makes sense.

Add and update tests.

- Grafted path static_h to hermes

Differential Revision: D69757360
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Feb 17, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69757360

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in c615b11.

@tmikov tmikov deleted the export-D69757360 branch February 18, 2025 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants