-
Notifications
You must be signed in to change notification settings - Fork 220
Surface persistence exceptions to the caller more often #1348
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
base: main
Are you sure you want to change the base?
Conversation
* If this result is failed, this should throw the appropriate exception which corresponds to the | ||
* result status. See {@link BaseResult#getException} for details. | ||
*/ | ||
public void maybeThrowException() throws RuntimeException { |
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.
This helper method is nice to have because you can't throw an exception from a lambda, so you can't do e.g. result.getException().foreach(e -> throw e)
Unfortunately some Iceberg tests essentially assert that these methods don't throw exceptions, e.g.
To pass these tests, we may want to gate this new behavior behind a flag |
|
||
String message = this.extraInformation; | ||
if (this.extraInformation == null) { | ||
// TODO this should ideally never be hit but it's hit often. |
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.
If we merge this, we should file an issue(s) tracking the many callsites where a non-successful result is built with a null
message. This might be a good starter task.
In many
...Catalog
methods likedropPolicy
ordropGenericTable
, we simply returnfalse
if there's aBaseResult
from persistence that doesn't have aSUCCESS
error code. In some cases like inIcebergCatalog
we do a little better, mapping a small subset of failures into exceptions.This PR pushes this mapping down into
BaseResult
so that methods which rely onBaseResult
to report the success of a persistence call can pass accurate information about the error back to the caller (via the exception mapper in the case of a REST call).In order to support some Iceberg tests that expect methods like
dropTable
not to throw an exception, this functionality is gated behind a feature flagDETAILED_PERSISTENCE_EXCEPTIONS