-
Notifications
You must be signed in to change notification settings - Fork 323
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
Improve backend error handling #11136
Conversation
- Fix debug logging for #11088--attempt to create an exception that is its own cause fails. - In case the parser is used after closing, throw an `IllegalStateException` instead of UB.
I think this change is necessary, but it doesn't seem to be sufficient: I'm still seeing the original exception, instead of the message attached when rethrowing.
|
@@ -18,7 +18,7 @@ public static Value getType(String moduleName, String typeName) { | |||
var ex = | |||
new NullPointerException( | |||
"Cannot get type for " + moduleName + " type: " + typeName + " at " + module); | |||
ex.initCause(ex); | |||
ex.initCause(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, thanks for the catch.
byte[] inputBytes = input.toString().getBytes(StandardCharsets.UTF_8); | ||
ByteBuffer inputBuf = ByteBuffer.allocateDirect(inputBytes.length); | ||
inputBuf.put(inputBytes); | ||
return parseTreeLazy(state, inputBuf); | ||
} | ||
|
||
public Tree parse(CharSequence input) { | ||
var state = getState(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this kind of robustness check cannot hurt.
- Fix debug logging for #11088 case--attempt to create an exception that is its own cause fails. - In case the parser is used after closing, throw an `IllegalStateException` instead of UB. (This case is not known to occur and doesn't seem to be behind the #11121, but we should handle it more safely if it does.) (cherry picked from commit e587d56)
Pull Request Description
IllegalStateException
instead of UB. (This case is not known to occur and doesn't seem to be behind the Parser crashing in native code due to multi-threaded access #11121, but we should handle it more safely if it does.)Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.