Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 8 additions & 3 deletions src/aws_durable_execution_sdk_python/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,14 @@ def from_exception(cls, exception: Exception) -> CheckpointError:
and (
# is not InvalidParam => Execution
(error.get("Code", "") or "") != "InvalidParameterValueException"
# is not Invalid Token => Execution
or not (error.get("Message") or "").startswith(
"Invalid Checkpoint Token"
or not (
# is not Invalid Token => Execution
(error.get("Message") or "").startswith("Invalid Checkpoint Token")
or
# is not Output Payload Too Large => Execution
(error.get("Message") or "").startswith(
"STEP output payload size must be less than or equal to"
)
Comment thread
yaythomas marked this conversation as resolved.
Outdated
)
)
):
Expand Down
17 changes: 17 additions & 0 deletions tests/exceptions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,23 @@ def test_checkpoint_error_classification_invalid_token_invocation():
assert not result.is_retriable()


def test_checkpoint_error_classification_payload_size_exceeded_invocation():
"""Test 4xx InvalidParameterValueException with STEP output payload size limit exceeded is invocation error."""
error_response = {
"Error": {
"Code": "InvalidParameterValueException",
"Message": "STEP output payload size must be less than or equal to 262144 bytes.",
},
"ResponseMetadata": {"HTTPStatusCode": 400},
}
client_error = ClientError(error_response, "Checkpoint")

result = CheckpointError.from_exception(client_error)

assert result.error_category == CheckpointErrorCategory.INVOCATION
assert not result.is_retriable()


def test_checkpoint_error_classification_other_4xx_execution():
"""Test other 4xx errors are execution errors."""
error_response = {
Expand Down
Loading