sanpwc commented on code in PR #4070:
URL: https://github.com/apache/ignite-3/pull/4070#discussion_r1678886098


##########
modules/core/src/main/java/org/apache/ignite/internal/lang/IgniteExceptionMapperUtil.java:
##########
@@ -115,7 +134,20 @@ public static Throwable mapToPublicException(Throwable 
origin) {
         }
 
         // There are no exception mappings for the given exception. This case 
should be considered as internal error.
-        return new IgniteException(INTERNAL_ERR, origin);
+        return mapCheckingResultIsPublic(origin, unknownProblemMapper);
+    }
+
+    private static Throwable mapCheckingResultIsPublic(Throwable origin, 
Function<Throwable, Throwable> unknownProblemMapper) {
+        Throwable result = unknownProblemMapper.apply(origin);
+
+        checkResultIsPublic(result, origin);
+
+        return result;
+    }
+
+    private static void checkResultIsPublic(Throwable mappingResult, Throwable 
origin) {
+        assert mappingResult instanceof IgniteException || mappingResult 
instanceof IgniteCheckedException :

Review Comment:
   I'd also add an assertion that mappingResult is not part of an internal 
package.



-- 
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