sanpwc commented on a change in pull request #488:
URL: https://github.com/apache/ignite-3/pull/488#discussion_r761965757



##########
File path: 
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -937,25 +874,49 @@ public void remove(@NotNull Throwable e) {
                                         
schemaCh.changeSchema(SchemaSerializerImpl.INSTANCE.serialize(descriptor));
                                     }));
                         }
-                )).exceptionally(t -> {
-                    LOG.error(LoggerMessageHelper.format("Table wasn't altered 
[name={}]", name), t);
+                )).whenComplete((res, t) -> {
+                    if (t != null) {
+                        Throwable ex = getRootCause(t);
 
-                    Throwable cause = t.getCause();
+                        assert ex != null;
 
-                    if (cause instanceof ConfigurationChangeException) {
-                        cause = cause.getCause();
-                    }
+                        LOG.error(LoggerMessageHelper.format("Table wasn't 
altered [name={}]", name), ex);
 
-                    removeListener(TableEvent.ALTER, clo, new 
IgniteInternalCheckedException(cause));
-
-                    return null;
+                        tblFut.completeExceptionally(ex);
+                    } else {
+                        tblFut.complete(res);
+                    }
                 });
             }
         });
 
         return tblFut;
     }
 
+    /**
+     * Gets a cause exception for a client.
+     *
+     * @param t Exception wrapper.
+     * @return Root exception if the exception is wrapped on.
+     */
+    private Throwable getRootCause(Throwable t) {
+        Throwable ex;
+
+        if (t instanceof CompletionException) {
+            if (t.getCause() instanceof ConfigurationChangeException) {
+                //TODO: IGNITE-16051 Only public exception for configuration 
validation should return here.
+                return t.getCause().getCause();
+            } else {
+                ex = t.getCause();
+            }
+
+        } else {
+            ex = t;
+        }
+
+        return ex instanceof IgniteException ? (IgniteException) ex : new 
IgniteException(ex);

Review comment:
       What if it's common java exception? Should we wrap it with 
IgniteException one?
   What if someone will add public IgniteCheckedExcpetion (or maybe it's even 
exists already), should we wrap it with IgniteException?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to