feat(sdk): add specific error types for callback operations#441
Merged
ParidelPooya merged 16 commits intomainfrom Feb 23, 2026
Merged
feat(sdk): add specific error types for callback operations#441ParidelPooya merged 16 commits intomainfrom
ParidelPooya merged 16 commits intomainfrom
Conversation
Add CallbackTimeoutError and CallbackSubmitterError to provide clear, unambiguous error handling for callback operations. Replace errorClass with more flexible errorMapper in ChildConfig. Changes: - Add CallbackTimeoutError for callback timeout scenarios - Add CallbackSubmitterError for submitter failures in waitForCallback - Add errorMapper to ChildConfig for flexible error type mapping - Remove errorClass from ChildConfig (replaced by errorMapper) - Update callback.ts to throw CallbackTimeoutError for TIMED_OUT status - Update waitForCallback to use errorMapper for consistent error types - Update all promise combinators to use errorMapper - Update fromErrorObject to reconstruct new error types - Export CallbackTimeoutError and CallbackSubmitterError - Update all tests to expect correct error types Error types by operation: - createCallback timeout -> CallbackTimeoutError - createCallback failure -> CallbackError - waitForCallback timeout -> CallbackTimeoutError - waitForCallback failure -> CallbackError - waitForCallback submitter failure -> CallbackSubmitterError Benefits: - Users can catch specific error types without parsing error messages - Consistent error handling across createCallback and waitForCallback - More flexible error customization via errorMapper - Type-safe error handling in TypeScript Fixes #420
Remove try-catch in wait-for-callback-timeout example to allow CallbackTimeoutError to propagate correctly. Update history.json to reflect ExecutionFailed instead of ExecutionSucceeded.
Add example that catches callback timeout error, waits, then checks error instance type in a step. Verifies that caught error is correctly identified as CallbackTimeoutError instance with proper name and message. This confirms error reconstruction works correctly across replays.
Move create-callback error-instance test to create-callback/error-instance. Add wait-for-callback error-instance test to wait-for-callback/error-instance. Both tests verify that CallbackTimeoutError instanceof checks work correctly across replays for their respective callback operations.
Update error-instance tests to verify all error types: - createCallback: CallbackTimeoutError, CallbackError - waitForCallback: CallbackTimeoutError, CallbackSubmitterError Each test catches multiple errors, waits, then checks instanceof in a step to verify error types persist correctly across replays.
…or types Test verifies instanceof checks work for: - CallbackError (callback failure via sendCallbackFailure) - CallbackTimeoutError (callback timeout) - CallbackSubmitterError (submitter throws error) Named callbacks for better test readability and uses InvocationType.Event to match other waitForCallback tests.
Add 30s timeout to first callback to prevent cloud integration test from hanging indefinitely. Local tests send failure quickly, but cloud tests need a safety timeout.
Add invocationCompletedDifference: 1 to handle timing differences between local and cloud test execution.
Reduce first callback timeout from 30s to 10s to make test fail faster if callback interaction doesn't happen in time. This prevents long waits in cloud integration tests.
Split waitForCallback error-instance test into 3 separate test suites, each with its own handler: - handlerFailure: tests CallbackError - handlerTimeout: tests CallbackTimeoutError - handlerSubmitter: tests CallbackSubmitterError This makes each test faster and less likely to timeout in cloud integration tests, while still comprehensively testing all error types.
Add console.log to see what the actual result structure is in cloud execution when the test fails.
Each error type (failure, timeout, submitter) now has its own directory with separate handler and test. This ensures each test deploys to its own cloud function, fixing the issue where all tests were running against the same handler in cloud execution. - error-instance-failure: Tests CallbackError from sendCallbackFailure - error-instance-timeout: Tests CallbackTimeoutError from 1s timeout - error-instance-submitter: Tests CallbackSubmitterError from submitter throw All tests passing locally.
…stance test The test was missing invocationType: InvocationType.Event, causing cloud tests to fail with 'InvocationType.undefined cannot wait for operation data'.
Lambda function names cannot contain parentheses. Changed: - 'Error Instance (Failure)' -> 'Error Instance Failure' - 'Error Instance (Timeout)' -> 'Error Instance Timeout' - 'Error Instance (Submitter)' -> 'Error Instance Submitter' This fixes ValidationException in cloud tests.
The submitter step was retrying 5 times with exponential backoff,
taking ~2 minutes. This caused cloud tests to timeout at 60 seconds.
Added retryStrategy: () => ({ shouldRetry: false }) to make the
submitter fail immediately without retries.
dhegberg
reviewed
Feb 17, 2026
yaythomas
approved these changes
Feb 20, 2026
|
for python aws/aws-durable-execution-sdk-python#313 |
|
similar for java sdk: aws/aws-durable-execution-sdk-java#147 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add CallbackTimeoutError and CallbackSubmitterError to provide clear, unambiguous error handling for callback operations. Replace errorClass with more flexible errorMapper in ChildConfig.
Changes:
Error types by operation:
Benefits:
Issue #, if available:
#420