[
https://issues.apache.org/jira/browse/IGNITE-16051?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Vladislav Pyatkov updated IGNITE-16051:
---------------------------------------
Description:
Currently, for pass an exception to the client code, we apply a local converter
like this:
{code}
/**
* Gets a cause exception for a client.
*
* @param t Exception wrapper.
* @return A root exception which will be acceptable to throw for public API.
*/
//TODO: IGNITE-16051 Implement exception converter for public API.
private @NotNull IgniteException getRootCause(Throwable t) {
Throwable ex;
if (t instanceof CompletionException) {
if (t.getCause() instanceof ConfigurationChangeException) {
ex = t.getCause().getCause();
} else {
ex = t.getCause();
}
} else {
ex = t;
}
return ex instanceof IgniteException ? (IgniteException) ex : new
IgniteException(ex);
}
{code}
This approach is not centralized and has some oblivious lacks:
* In the future, it will lead to duplicate parts of code in different
components.
* Even common java exceptions will be wrapped to Ignite exception, like that
NullPointerException, IndexOutOfBound and others.
* This method does not support to throw a checked exception, although it is not
excluded in real life.
> Implement exception converter for public API
> --------------------------------------------
>
> Key: IGNITE-16051
> URL: https://issues.apache.org/jira/browse/IGNITE-16051
> Project: Ignite
> Issue Type: Improvement
> Reporter: Vladislav Pyatkov
> Priority: Major
> Labels: ignite-3
>
> Currently, for pass an exception to the client code, we apply a local
> converter like this:
> {code}
> /**
> * Gets a cause exception for a client.
> *
> * @param t Exception wrapper.
> * @return A root exception which will be acceptable to throw for public API.
> */
> //TODO: IGNITE-16051 Implement exception converter for public API.
> private @NotNull IgniteException getRootCause(Throwable t) {
> Throwable ex;
> if (t instanceof CompletionException) {
> if (t.getCause() instanceof ConfigurationChangeException) {
> ex = t.getCause().getCause();
> } else {
> ex = t.getCause();
> }
> } else {
> ex = t;
> }
> return ex instanceof IgniteException ? (IgniteException) ex : new
> IgniteException(ex);
> }
> {code}
> This approach is not centralized and has some oblivious lacks:
> * In the future, it will lead to duplicate parts of code in different
> components.
> * Even common java exceptions will be wrapped to Ignite exception, like that
> NullPointerException, IndexOutOfBound and others.
> * This method does not support to throw a checked exception, although it is
> not excluded in real life.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)