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

Duplicate errors that are un-writable #9046

Merged
merged 6 commits into from
May 3, 2017

Conversation

jridgewell
Copy link
Contributor

Certain errors (DOMExceptions, really) have un-writable error
messages. This mucks with our code, since we rewrite it to signal user
errors, give context, etc.

If an error's message isn't writable, duplicate the error with one that
is.

Fixes #8917.

e[prop] = error[prop];
}
// Ensure these are copied.
e.stack = error.stack;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really a thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not 100% sure that stack is an enumerable property in all browsers, so it seemed like a good defense.

Or, are you asking about overriding the stack? In that case, yup, it's a thing. It's used a lot to clean stack traces, avoiding "internal" frames.

Certain errors (`DOMException`s, really) have un-writable error
messages. This mucks with our code, since we rewrite it to signal user
errors, give context, etc.

If an error's message isn't writable, duplicate the error with one that
is.
@jridgewell jridgewell merged commit fa6c851 into ampproject:master May 3, 2017
@muxin
Copy link
Contributor

muxin commented May 3, 2017

Do I need to cherry pick this to 1% canary (to be promoted to prod) and opt in canary (to be deployed)?

@jridgewell
Copy link
Contributor Author

Nah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants