Skip to content

Commit 16aea02

Browse files
TrickSumoyaythomas
andauthored
docs(power): use class references instead of strings in retryableErrorTypes examples (#172)
* Update error-handling.md Fixed error * Update step-operations.md fix: use class references instead of strings in retryableErrorTypes examples * Update error-handling.md * Update error-handling.md * Apply suggestion from @yaythomas --------- Co-authored-by: thomas <18520168+yaythomas@users.noreply.github.com>
1 parent 82f45ab commit 16aea02

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

aws-lambda-durable-functions-power/steering/error-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const result = await context.step(
121121
{
122122
retryStrategy: createRetryStrategy({
123123
maxAttempts: 3,
124-
retryableErrorTypes: ['NetworkError', 'TimeoutError'],
124+
retryableErrorTypes: [NetworkError],
125125
// ValidationError won't be retried
126126
})
127127
}

aws-lambda-durable-functions-power/steering/step-operations.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,21 @@ result = context.step(
155155
**TypeScript:**
156156

157157
```typescript
158+
class NetworkError extends Error {
159+
name = 'NetworkError';
160+
}
161+
162+
class TimeoutError extends Error {
163+
name = 'TimeoutError';
164+
}
165+
158166
const result = await context.step(
159167
'selective-retry',
160168
async () => operation(),
161169
{
162170
retryStrategy: createRetryStrategy({
163171
maxAttempts: 3,
164-
retryableErrorTypes: ['NetworkError', 'TimeoutError']
172+
retryableErrorTypes: [NetworkError, TimeoutError]
165173
})
166174
}
167175
);

0 commit comments

Comments
 (0)