Skip to content

Conversation

@leandrodamascena
Copy link
Contributor

closes #165

Description of changes:

This PR adds docs/advanced/error-handling.md documentation for error handling in durable functions. The guide explains exception types (DurableExecutionsError, InvocationError, ValidationError), AWS-compliant error response formats, and HTTP status code mappings. It covers retry strategies for transient failures, error propagation through operations, and troubleshooting guidance for common scenarios. The testing section shows how to assert on error conditions with test examples.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

| `CallbackError` | No | Returns FAILED status | Callback handling failures |
| `StepInterruptedError` | Yes (automatic) | Retries on next invocation | Step interrupted before checkpoint |
| `CheckpointError` | Depends | Retries if 4xx (except invalid token) | Failed to save execution state |
| `SerDesError` | No | Returns FAILED status | Serialization failures |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does retry from inside a step

initial_delay_seconds=1,
max_delay_seconds=10,
backoff_rate=2.0,
retryable_error_types=[RuntimeError, ConnectionError],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    retryable_errors: list[str | re.Pattern] = field(
        default_factory=lambda: [re.compile(r".*")]
    )
    retryable_error_types: list[type[Exception]] = field(default_factory=list)

we might want to revisit this logic:

        # Check if error is retryable based on error message
        is_retryable_error_message = any(
            pattern.search(str(error))
            if isinstance(pattern, re.Pattern)
            else pattern in str(error)
            for pattern in config.retryable_errors
        )

        # Check if error is retryable based on error type
        is_retryable_error_type = any(
            isinstance(error, error_type) for error_type in config.retryable_error_types
        )

        if not is_retryable_error_message and not is_retryable_error_type:
            return RetryDecision.no_retry()

if e.g you only want to retry ErrorX and you set

RetryStrategyConfig(retryable_error_types = [ErrorX])

it will still retry basically ALL errors because retryable_errors defaults to a permissive regex - this looks counterintuitive to me.

@ParidelPooya + @PartiallyUntyped

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @yaythomas the PR to fix this is merged. Do you have any additional feedback?

@yaythomas yaythomas force-pushed the docs_sdk/11-error-handling branch from 3c309dd to a03195c Compare December 8, 2025 19:47
@yaythomas yaythomas merged commit 277915a into main Dec 8, 2025
15 checks passed
@yaythomas yaythomas deleted the docs_sdk/11-error-handling branch December 8, 2025 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: add documentation about error handling

2 participants