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

catch error in runAsChild callback #15578

Merged
merged 2 commits into from Apr 1, 2022
Merged

Conversation

vankop
Copy link
Member

@vankop vankop commented Mar 23, 2022

What kind of change does this PR introduce?
closes #13624

Did you add tests for your changes?
no need

Does this PR introduce a breaking change?
no

What needs to be documented once your changes are merged?
nothing

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Looks good, but I am afraid it can be breaking change... but for me it is valid behavior

@webpack-bot
Copy link
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

@vankop vankop closed this Mar 24, 2022
@vankop vankop reopened this Mar 24, 2022
callback(null, entries, compilation);
} catch (e) {
const err = new WebpackError(
`compiler.runAsChild callback error: ${e}`
Copy link
Member

Choose a reason for hiding this comment

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

This swallows the stack trace. Maybe add err.details = e.stack

lib/Compiler.js Outdated
Comment on lines 551 to 552
if (err) return callback(err);
callback(null, entries, compilation);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (err) return callback(err);
callback(null, entries, compilation);
callback(err, entries, compilation);

@webpack-bot
Copy link
Contributor

@vankop Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@sokra Please review the new changes.

@sokra sokra merged commit 4a0937f into main Apr 1, 2022
@sokra sokra deleted the feat/catch-error-in-run-as-child branch April 1, 2022 13:26
@sokra
Copy link
Member

sokra commented Apr 1, 2022

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.

Webpack ignores errors thrown in callback passed to runAsChild()
4 participants