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

Avoid Error cloning error in Worker promise/rejection case #45

Merged
merged 2 commits into from
Jan 19, 2017

Conversation

padolsey
Copy link
Owner

 - See #44
 - Specifically pass message/stack and then catch on the other side
postMessage({
cmd: 'deferred_reject_error',
token: data.token,
error: {
Copy link

@cdhowie cdhowie Jan 15, 2017

Choose a reason for hiding this comment

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

If we replace this (error) object literal with JSON.parse(JSON.stringify(r)) then we can side-step any structured cloning errors while still having a fairly complete view of the error.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ah yes, though shall probably have to resort to this as JSON.stringify(new Error('foo')) seems to give us nothing.

Copy link

Choose a reason for hiding this comment

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

Ah, right. There might even be an npm module for this.

@padolsey padolsey merged commit c9eb833 into master Jan 19, 2017
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.

2 participants