Skip to content

Commit 3476ed4

Browse files
committed
Merge branch 'fix/checkpoint-wrapped-error' into fix/telemetry-align-with-js
2 parents f6350db + 8dde1e7 commit 3476ed4

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎sdk/src/main/java/software/amazon/lambda/durable/operation/ChildContextOperation.java‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import software.amazon.lambda.durable.exception.CallbackTimeoutException;
2626
import software.amazon.lambda.durable.exception.ChildContextFailedException;
2727
import software.amazon.lambda.durable.exception.DurableOperationException;
28+
import software.amazon.lambda.durable.exception.InvokeFailedException;
2829
import software.amazon.lambda.durable.exception.InvokeStoppedException;
2930
import software.amazon.lambda.durable.exception.InvokeTimedOutException;
3031
import software.amazon.lambda.durable.exception.MapIterationFailedException;
@@ -256,18 +257,22 @@ public T get() {
256257
* wrapped (original) error, never the wrapper.
257258
*
258259
* <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.
264266
*/
265267
static ErrorObject wrappedError(DurableOperationException exception) {
266268
var original = exception.getErrorObject();
267269
boolean namedBySdk = exception instanceof CallbackTimeoutException
268270
|| exception instanceof InvokeTimedOutException
269271
|| 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) {
271276
return original;
272277
}
273278
var message =

0 commit comments

Comments
 (0)