Skip to content

Commit a1d31f3

Browse files
authored
feat: user friendly message for StepInterruptedException (#495)
1 parent cc076e4 commit a1d31f3

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

sdk/src/main/java/software/amazon/lambda/durable/exception/StepInterruptedException.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,23 @@
77

88
/** Exception thrown when a step with AT_MOST_ONCE_PER_RETRY semantics was started but interrupted before completion. */
99
public class StepInterruptedException extends StepException {
10+
private static final String ERROR_TYPE = StepInterruptedException.class.getName();
11+
1012
public StepInterruptedException(Operation operation) {
11-
super(operation, toErrorObject(), formatMessage(operation));
13+
super(operation, toErrorObject(operation), formatMessage(operation));
1214
}
1315

1416
public static boolean isStepInterruptedException(ErrorObject errorObject) {
1517
if (errorObject == null) {
1618
return false;
1719
}
18-
return StepInterruptedException.toErrorObject().errorType().equals(errorObject.errorType());
20+
return ERROR_TYPE.equals(errorObject.errorType());
1921
}
2022

21-
private static ErrorObject toErrorObject() {
23+
private static ErrorObject toErrorObject(Operation operation) {
2224
return ErrorObject.builder()
23-
.errorType(StepInterruptedException.class.getName())
25+
.errorType(ERROR_TYPE)
26+
.errorMessage(formatMessage(operation))
2427
.build();
2528
}
2629

0 commit comments

Comments
 (0)