Skip to content

Commit

Permalink
Include failure message in Nexus exception (temporalio#2251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Quinn-With-Two-Ns committed Oct 10, 2024
1 parent 1c509d6 commit 238ca06
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ private TemporalFailure failureToExceptionImpl(Failure failure, DataConverter da
{
NexusOperationFailureInfo info = failure.getNexusOperationExecutionFailureInfo();
return new NexusOperationFailure(
failure.getMessage(),
info.getScheduledEventId(),
info.getEndpoint(),
info.getService(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,17 @@ public final class NexusOperationFailure extends TemporalFailure {
private final String operationId;

public NexusOperationFailure(
String message,
long scheduledEventId,
String endpoint,
String service,
String operation,
String operationId,
Throwable cause) {
super(getMessage(scheduledEventId, endpoint, service, operation, operationId), null, cause);
super(
getMessage(message, scheduledEventId, endpoint, service, operation, operationId),
message,
cause);
this.scheduledEventId = scheduledEventId;
this.endpoint = endpoint;
this.service = service;
Expand All @@ -53,16 +57,24 @@ public NexusOperationFailure(
}

public static String getMessage(
String originalMessage,
long scheduledEventId,
String endpoint,
String service,
String operation,
String operationId) {
return "Nexus Operation with operation='"
+ operation
+ "service='"
+ service
+ "' endpoint='"
+ endpoint
+ "' failed: '"
+ originalMessage
+ "'. "
+ "scheduledEventId="
+ scheduledEventId;
+ scheduledEventId
+ (operationId == null ? "" : ", operationId=" + operationId);
}

public long getScheduledEventId() {
Expand Down

0 comments on commit 238ca06

Please sign in to comment.