From 97ccf0dd5cd3b0fea8bf5a82ad81cde75a6e8652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=84=82=CA=8F=E1=B4=87=E1=B4=85=20=F0=9F=84=B0=CA=99?= =?UTF-8?q?=E1=B4=85=E1=B4=9C=CA=9F=20=F0=9F=84=B0=E1=B4=8D=E1=B4=80?= =?UTF-8?q?=F0=9F=84=9D=20=E2=9C=A7?= Date: Tue, 26 May 2026 15:22:50 +0530 Subject: [PATCH] Fix TypeScript unrecoverable error docs --- .../steering/error-handling.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/aws-lambda-durable-functions-power/steering/error-handling.md b/aws-lambda-durable-functions-power/steering/error-handling.md index f37a94e..5f92b09 100644 --- a/aws-lambda-durable-functions-power/steering/error-handling.md +++ b/aws-lambda-durable-functions-power/steering/error-handling.md @@ -234,23 +234,29 @@ def handler(event: dict, context: DurableContext) -> dict: ## Unrecoverable Errors -Mark errors as unrecoverable to stop execution immediately: +Configure non-retryable failures to stop execution immediately: **TypeScript:** +The TypeScript SDK does not currently expose a public unrecoverable error type. +Use a no-retry strategy when a step should fail immediately. + ```typescript -import { UnrecoverableInvocationError } from '@aws/durable-execution-sdk-js'; +import { retryPresets } from '@aws/durable-execution-sdk-js'; export const handler = withDurableExecution(async (event, context: DurableContext) => { const user = await context.step('fetch-user', async () => { const user = await fetchUser(event.userId); if (!user) { - // Stop execution immediately - no retry - throw new UnrecoverableInvocationError('User not found'); + // This error fails the step immediately because retryPresets.noRetry + // disables retries for this step. + throw new Error('User not found'); } return user; + }, { + retryStrategy: retryPresets.noRetry, }); // Continue processing... @@ -422,7 +428,7 @@ export const handler = withDurableExecution(async (event, context: DurableContex 2. **Classify errors correctly** - distinguish retryable from non-retryable 3. **Implement compensating transactions** for distributed workflows 4. **Make errors deterministic** - same input produces same error -5. **Use unrecoverable errors** to stop execution early when appropriate +5. **Disable retries for non-retryable errors** to stop execution early when appropriate 6. **Log errors with context** using `context.logger` 7. **Handle partial failures** gracefully in batch operations 8. **Implement circuit breakers** for external service calls