Repository navigation
Add HarmonyLinkingError class - #6932
Conversation
| `Can't reexport ${exportName} from non EcmaScript module (only default export is available)` | ||
| ); | ||
| err.hideStack = true; | ||
| return [err]; |
There was a problem hiding this comment.
Inline the new HiddenStackError call into the array construction.
| const err = new Error(errorMessage); | ||
| err.hideStack = true; | ||
| const err = new HiddenStackError(errorMessage); | ||
| return [err]; |
| `Can't import ${exportName} from non EcmaScript module (only default export is available)` | ||
| ); | ||
| err.hideStack = true; | ||
| return [err]; |
| const err = new Error(errorMessage); | ||
| err.hideStack = true; | ||
| const err = new HiddenStackError(errorMessage); | ||
| return [err]; |
| */ | ||
| "use strict"; | ||
|
|
||
| module.exports = class HiddenStackError extends Error { |
There was a problem hiding this comment.
Inherit from WebpackError like the other Error classes.
Maybe you can make the class more meaningful by naming it like HarmonyLinkingError?
| @@ -3,4 +3,4 @@ module.exports = function() { | |||
| err.stack = "Stack"; | |||
| err.hideStack = true; | |||
There was a problem hiding this comment.
I'm not sure how these tests work. Can I import HarmonyLinkingError here too?
There was a problem hiding this comment.
You could, but this test is already fine. Loaders won't do use HarmonyLinkingError since they probably have own error classes or just add a property.
|
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
| @@ -3,4 +3,4 @@ module.exports = function() { | |||
| err.stack = "Stack"; | |||
| err.hideStack = true; | |||
There was a problem hiding this comment.
You could, but this test is already fine. Loaders won't do use HarmonyLinkingError since they probably have own error classes or just add a property.
|
Thanks |
What kind of change does this PR introduce?
Refactoring
Did you add tests for your changes?
No
If relevant, link to documentation update:
N/A
Summary
Instead of adding a property to
Error, introduce a new error constructor that has this property set to true. This will help TypeScript migration (#6862) as well.Does this PR introduce a breaking change?
Hopefully not!