Skip to content

Commit 0d86078

Browse files
marco sappe griotmarcosgopen
authored andcommitted
Throw the proper error message when the supportFailover is false and the start method fails
1 parent 201ff41 commit 0d86078

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

client/src/main/java/io/narayana/lra/client/NarayanaLRAClient.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,13 @@ public URI startLRA(URI parentLRA, String clientID, Long timeout, ChronoUnit uni
465465
// Handle connection exceptions, async timeout, and execution failures
466466
Throwable t = e.getCause();
467467

468-
if (supportsFailover && i == coordinatorCount - 1) {
468+
if (!supportsFailover) {
469+
String errMsg = LRALogger.i18nLogger.warn_startLRAFailed(e.getMessage());
470+
LRALogger.logger.warn("Start LRA failed and failover is not enabled: " + e.getMessage());
471+
LRALogger.logger.warn(errMsg, e);
472+
throw new WebApplicationException(Response.status(SERVICE_UNAVAILABLE).entity(errMsg).build());
473+
}
474+
if (i == coordinatorCount - 1) {
469475

470476
String errMsg = "";
471477
if (t instanceof ServiceUnavailableException) {

0 commit comments

Comments
 (0)