-
Notifications
You must be signed in to change notification settings - Fork 27
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
Losing stacktrace on error during compound tag write #127
Comments
Yes, unfortunately, the error handling in all packages are unified and not throwing |
In that case I'd propose completely removing the surrounding try-catch. Is that okay with you? |
Well, I suggest you to wrap another error containing the same fields with the original one. |
Hold on, I don't think I understand. You want to wrap the error, inside another error. Why would you want to do that? |
They major reason I catch and rethrow here, is because this error occurred during user use the API correctly, but maybe the pass-in data is not valid. And I don't want the error diving into the |
Oooh I get it. You just want to throw a new error. I thought you meant "wrapping" in the sense of Java's "caused by" mechanism, which confused me. I'll create a PR for this. |
When debugging #125 I noticed that stacktraces get lost if an error occurs when writing a compound tag. Instead of a helpful pointer to offending code, I got the following error from jest:
As you can probably imagine, this wasn't a fun one to debug 😓
The offending code:
minecraft-launcher-core-node/packages/nbt/index.ts
Lines 332 to 343 in 6b9dc80
I think the stacktrace is lost because a 'plain object' is thrown instead of an actual
Error
. (I didn't even know you could do that, although I'm definitely not surprised.)The (false) stacktrace that's listed in the log points to jest code that creates an
Error
instance. This is probably the error that causes the actual message in the log, thus creating a false stacktrace.The text was updated successfully, but these errors were encountered: