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

Only call captureStackTrace when possible #141

Merged
merged 2 commits into from Apr 1, 2019
Merged

Only call captureStackTrace when possible #141

merged 2 commits into from Apr 1, 2019

Conversation

SamVerschueren
Copy link
Collaborator

This PR fixes #135.

@sindresorhus You pointed to this block which does

if ('captureStackTrace' in Error) {
	Error.captureStackTrace(this, context);
} else {
	this.stack = new Error(message).stack;
}

It looks like the else clause is moot, no? So I left it out. Let me know if it isn't :).

@sindresorhus
Copy link
Owner

Seems like Travis is failing.

@sindresorhus
Copy link
Owner

It looks like the else clause is moot, no? So I left it out. Let me know if it isn't :).

It's not moot. It's useful to get a better stack trace in non-V8 environments.

@SamVerschueren
Copy link
Collaborator Author

But isn't this.stack already defined as we are extending from error? So feels like we are just overwriting it with the same value.

@sindresorhus
Copy link
Owner

Good point. You're right, it's not needed.

@SamVerschueren
Copy link
Collaborator Author

SamVerschueren commented Apr 1, 2019

Fixed the travis errors as well.

@sindresorhus sindresorhus changed the title Only call captureStackTrace when possible - fixes #135 Only call captureStackTrace when possible Apr 1, 2019
@sindresorhus sindresorhus merged commit e697ccd into master Apr 1, 2019
@sindresorhus sindresorhus deleted the iss135 branch April 1, 2019 08:12
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.

Error.captureStackTrace does not work in Firefox
2 participants