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

fix: provide useful stacktrace on chunk loading failure #9128

Merged
merged 1 commit into from May 20, 2019
Merged

fix: provide useful stacktrace on chunk loading failure #9128

merged 1 commit into from May 20, 2019

Conversation

rchl
Copy link
Contributor

@rchl rchl commented May 13, 2019

Error created from load/error event handler has no useful stack trace whatsoever as it's an async event and stack has unwound already at that point.

To have better (sync) stacktrace of what triggered loading of the chunk, create error before stack has unwound and use it and its stacktrace later, in case of an error.

The reason this is useful, is that it allows to trace the root code that triggered problematic load of the chunk. Especially when using systems like Sentry where we don't know exactly how or where given failure has been triggered. This allows to better see the code that triggered the chunk and potentially to figure out the actual problem.

This potentially has some processing overhead as browser needs to create a stacktrace. It's probably not that big though but I haven't done any real testing.

Fixes: #9109

What kind of change does this PR introduce?

bugfix

Did you add tests for your changes?

no. I'm not too familiar with infrastracture. Would need to have more time to do it. Ideally someone with more knowledge would take over if this PR is accepted.

Does this PR introduce a breaking change?

Not that I can think of.

What needs to be documented once your changes are merged?

none

@webpack-bot
Copy link
Contributor

For maintainers only:

  • This need to be documented (issue in webpack/webpack.js.org will be filed when merged)

Error created from load/error event handler has no useful stack trace
whatsoever as it's an async event and stack has unwound already at that
point.

To have better (sync) stacktrace of what triggered loading of the
chunk, create error before stack has unwound and use it and its
stacktrace later, in case of an error.

This potentially has some processing overhead as browser needs to
create a stacktrace. It's probably not that big though but I haven't
done any real testing.
@webpack-bot
Copy link
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@sokra sokra merged commit 36c7ab7 into webpack:master May 20, 2019
@sokra
Copy link
Member

sokra commented May 20, 2019

Thanks

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.

Include stack trace when reporting loading chunk error
3 participants