AMashenkov commented on code in PR #2616:
URL: https://github.com/apache/ignite-3/pull/2616#discussion_r1337411086
##########
modules/core/src/main/java/org/apache/ignite/internal/lang/IgniteExceptionMapperUtil.java:
##########
@@ -140,4 +142,22 @@ public static <T> CompletableFuture<T>
convertToPublicFuture(CompletableFuture<T
private static <T extends Exception, R extends Exception> Exception
map(IgniteExceptionMapper<T, R> mapper, Throwable t) {
return mapper.map(mapper.mappingFrom().cast(t));
}
+
+ /**
+ * Assert that passed exception is not related to internal exceptions.
+ *
+ * @param ex Exception to be checked.
+ * @return {@code true} if canonical name of passed Exception doesn't
contains word 'internal'.
+ * @throws AssertionError in case assertions is enabled and passed
exception is fail check.
+ */
+ public static boolean assertInternal(Throwable ex) {
+ //IGNITE-20348: uncomment during implement the ticket.
+ // boolean isPublic =
!ex.getClass().getCanonicalName().toLowerCase().contains("internal");
+ //
+ // assert isPublic : "public Exception can't be in internal
package " + ex.getClass().getCanonicalName();
+ //
+ // return isPublic;
Review Comment:
I think such validation must be done in ArchUnitTest, where we could check
internal exception never leak to public package and vice versa, instead of
doing that at runtime.
Here, we should only check if the given exception doesn't inherits public
IgniteException class via `instance of` operator... or smth like that.
--
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]