From 930dfe2e264c1eaa928eb825b7bca2e82439d430 Mon Sep 17 00:00:00 2001 From: Julian Reschke Date: Thu, 26 Sep 2024 14:12:58 +0100 Subject: [PATCH] OAK-11151: rdbmk: when wrapping into DocumentStoreException, add message for causing exception to new message --- .../jackrabbit/oak/plugins/document/rdb/RDBJDBCTools.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBJDBCTools.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBJDBCTools.java index 322ee876353..7310aa88235 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBJDBCTools.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBJDBCTools.java @@ -425,12 +425,13 @@ public int setParameters(PreparedStatement stmt, int startIndex) throws SQLExcep } }; } - + private static DocumentStoreException.Type exceptionTypeFor(Exception cause) { return (cause instanceof SQLTransientException) ? DocumentStoreException.Type.TRANSIENT : DocumentStoreException.Type.GENERIC; } - + public static DocumentStoreException asDocumentStoreException(@NotNull Exception cause, @NotNull String message) { - return new DocumentStoreException(message, cause, exceptionTypeFor(cause)); + return new DocumentStoreException(message + (cause != null ? " (cause: " + cause.getMessage() + ")" : ""), cause, + exceptionTypeFor(cause)); } }