You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...and seems to have been introduced in 23c111c (Rollup v3.25.0).
The assumption seems to be that, if error.code is truthy, then it's a string type. However, a plugin may throw an Error with a numeric type for error.code.
The text was updated successfully, but these errors were encountered:
For customized errors in Plugin, I personally recommend using this.error api with type hints, it will tell us that Rollup expects code to be of type string.
@TrickyPi That's totally reasonable, but unless I wrap everything in my plugin in a try/catch, I cannot be sure that I don't have some deep dependency that is throwing an Error with a numeric code.
Rollup Version
3.25.1
Operating System (or Browser)
MacOS
Node Version (if applicable)
16
Link To Reproduction
https://stackblitz.com/edit/rollup-repro-hc1mbx?file=rollup.config.js
Expected Behaviour
When a plugin throws an error with a numeric code, like so:
... I would expect this to go through the normal Rollup plugin error reporting process.
Actual Behaviour
An error is thrown from within Rollup itself:
This error comes from this line of code:
rollup/src/utils/logs.ts
Line 790 in 63b7125
...and seems to have been introduced in 23c111c (Rollup v3.25.0).
The assumption seems to be that, if
error.code
is truthy, then it's a string type. However, a plugin may throw an Error with a numeric type forerror.code
.The text was updated successfully, but these errors were encountered: