Skip to content

Commit

Permalink
OAK-11151: rdbmk: when wrapping into DocumentStoreException, add mess…
Browse files Browse the repository at this point in the history
…age for causing exception to new message
  • Loading branch information
reschke committed Sep 26, 2024
1 parent 9f26450 commit 930dfe2
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

0 comments on commit 930dfe2

Please sign in to comment.