|
25 | 25 | import software.amazon.lambda.durable.exception.CallbackTimeoutException; |
26 | 26 | import software.amazon.lambda.durable.exception.ChildContextFailedException; |
27 | 27 | import software.amazon.lambda.durable.exception.DurableOperationException; |
| 28 | +import software.amazon.lambda.durable.exception.InvokeFailedException; |
28 | 29 | import software.amazon.lambda.durable.exception.InvokeStoppedException; |
29 | 30 | import software.amazon.lambda.durable.exception.InvokeTimedOutException; |
30 | 31 | import software.amazon.lambda.durable.exception.MapIterationFailedException; |
@@ -256,18 +257,22 @@ public T get() { |
256 | 257 | * wrapped (original) error, never the wrapper. |
257 | 258 | * |
258 | 259 | * <p>A wrapper such as {@code StepFailedException} or {@code CallbackFailedException} carries the original error's |
259 | | - * {@link ErrorObject}; when that object has a type, it is checkpointed as it is. An SDK error that names the |
260 | | - * failure itself (a timed-out callback, a timed-out or stopped invoke), or an exception whose {@link ErrorObject} |
261 | | - * is missing or has no type, is checkpointed under its own class name, keeping the original message, data and stack |
262 | | - * trace when there are any. The context checkpoint then always says which error failed it, so a reader of the |
263 | | - * checkpoint never has to look at the context's children, which the backend can prune once the context completes. |
| 260 | + * {@link ErrorObject}, which is checkpointed as it is. An SDK error that names the failure itself (a timed-out |
| 261 | + * callback, a timed-out or stopped invoke), and a callback or invoke failure whose error has no type, is |
| 262 | + * checkpointed under its own class name instead, keeping the original message, data and stack trace when there are |
| 263 | + * any: its {@link ErrorObject} is missing or is the stop error, so it does not say which error failed the context. |
| 264 | + * The context checkpoint then says which error failed it without its children, which the backend can prune once the |
| 265 | + * context completes. Any other operation exception keeps its error object as it is, including a missing one. |
264 | 266 | */ |
265 | 267 | static ErrorObject wrappedError(DurableOperationException exception) { |
266 | 268 | var original = exception.getErrorObject(); |
267 | 269 | boolean namedBySdk = exception instanceof CallbackTimeoutException |
268 | 270 | || exception instanceof InvokeTimedOutException |
269 | 271 | || exception instanceof InvokeStoppedException; |
270 | | - if (!namedBySdk && original != null && !isBlankType(original.errorType())) { |
| 272 | + boolean typelessFailure = (exception.getClass() == CallbackFailedException.class |
| 273 | + || exception.getClass() == InvokeFailedException.class) |
| 274 | + && (original == null || isBlankType(original.errorType())); |
| 275 | + if (!namedBySdk && !typelessFailure) { |
271 | 276 | return original; |
272 | 277 | } |
273 | 278 | var message = |
|
0 commit comments