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
no useful error info from plugins emitted in API watch events #4687
Comments
|
I guess the problem casued by the following code: // workaround: err.stack contains err.message and Rollup prints both, causing duplication, so split out the stack itself if it exists (c.f. https://github.com/ezolenko/rollup-plugin-typescript2/issues/103#issuecomment-1172820658)
const stackOnly = err.stack?.split(err.message)[1];
if (stackOnly)
this.error({ ...err, message: err.message, stack: stackOnly });
else
this.error(err); rollup: Line 17 in 243eba5
When executing Btw, the purpose of rollup-plugin-typescript2 code above is to fix cli error, and i thinks it's a rollup bug: Line 33 in 243eba5
relative issues: Back to this issue, I think it's not a rollup bug, we don't need to change the |
Ah yes, I guess you are right. I thought the issue was something else. But if in the reproduction you log |
@lukastaegert It could be closed. |
Will close this, but it still needs an upstream fix in Rollup-plugin-typescript2 to no longer shorten stack traces. |
Thanks for fixing this in #4749 @TrickyPi ! I meant to PR some changes upstream here to
downstream*. rpt2 currently supports down to Rollup 1.26.3, so we'd have to leave this in until we bump past 3.7.5. I was looking to proactively bump rpt2's peerDep range to |
Welp, I spoke too soon. Edited that out.
I see the change is actually a bit different than I anticipated, so maybe rpt2 does need to bump to 3.7.5.
I am actually a little confused by this issue. ezolenko/rollup-plugin-typescript2#373 indeed retains all the fields of the error object.
That is a very nice find! Thanks for noting that down in detail as well! I'm trying to understand why this specifically impacts watch mode only; this sounds like watch mode has different error logging than non-watch? Wouldn't this normally impact both? Or does the |
Thanks for your feedback.
The stack value is changed in this condition
This PR fixes the issue of logging error name and message repeatedly in the |
Yes, but
Yes the PR makes total sense to me. I meant the issue itself as written by OP, not the PR. The issue itself apparently only impacts "API watch events" |
also impacts non-watch mode. Please see https://stackblitz.com/edit/github-rgywtn?file=build-tool_.js that forked from the reproduction of this issue, I added a new js file |
Hmm interesting, We might need to add a similar in-line plugin to our integration test suite (or in watch mode tests) to be able to catch such a regression, definitely did not test for something like that 🤔 |
Rollup Version
3.2.3
Operating System (or Browser)
macOS & fedora 36, node
Node Version (if applicable)
16.5 & 17.7.1
Link To Reproduction
https://github.com/schlawg/rollup-plugin-error
Expected Behaviour
Javascript API rollup.watch should provide specifics sourced from typescript plugins when it emits ERROR events. This should include message, frame, location, and filename. I noticed that rollup-plugin-typescript2 does provide this information (in some form) when error.ts/error is called and the specifics survive in the exception caught and thrown by rollup watch's internals before reaching the watch emitter. Maybe it's not in the proper form and that's why it's stripped?
Actual Behaviour
Events from the rpt2 plugin used in the minimal repro link look like:
There is no message, frame, or TS error code provided, but this information is clearly visible if you dump the error object from rpt2 to stdout in error.ts error function.
The text was updated successfully, but these errors were encountered: