Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include failure message in Nexus exception #2251

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading