Skip to content

Conversation

@masfworld
Copy link

There are scenarios where there are RESTException issues but the message is providing value. For instance:

org.apache.iceberg.exceptions.RESTException: Unable to process: \n\tat
org.apache.iceberg.rest.ErrorHandlers$DefaultErrorHandler.accept(ErrorHandlers.java:250)\n\tat
org.apache.iceberg.rest.ErrorHandlers$TableErrorHandler.accept(ErrorHandlers.java:124)\n\tat
org.apache.iceberg.rest.ErrorHandlers$TableErrorHandler.accept(ErrorHandlers.java:108)\n\tat

So, the idea is to provide code and type in RESTException to get more context.

@github-actions github-actions bot added the core label Dec 24, 2025
}

throw new RESTException("Unable to process: %s", error.message());
throw new RESTException(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while we are here can we also add error code and type in

throw new RESTException("Unable to process: %s", error.message());

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But here it's clear because this exception is triggered when the code is 422, which is Unprocessable Entity, then the current message for me is enough.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO its more about consistency than enhancing, for example we can say all the rest exception follow this pattern, since we don't have defined exception for it, it would be great to have this consistently have an error message format, WDYT ?

throw new RESTException("Unable to process: %s", error.message());
throw new RESTException(
"Unable to process (code: %s, type: %s): %s",
error.code(), error.type() != null ? error.type() : "unknown", error.message());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if making the null as unknown adds more value ? how about just having error.type() ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants