Skip to content

Commit e4968bf

Browse files
authored
created custom error with existingRecord field
1 parent 68fc758 commit e4968bf

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/idempotency/src/errors.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
import { AttributeValue } from '@aws-sdk/client-dynamodb';
12
/**
23
* Item attempting to be inserted into persistence store already exists and is not expired
34
*/
4-
class IdempotencyItemAlreadyExistsError extends Error {}
5+
class IdempotencyItemAlreadyExistsError extends Error {
6+
public existingRecord: Record<string, AttributeValue> | undefined;
7+
8+
public constructor(
9+
message: string,
10+
existingRecord: Record<string, AttributeValue> | undefined
11+
) {
12+
super(message);
13+
this.existingRecord = existingRecord;
14+
}
15+
}
516

617
/**
718
* Item does not exist in persistence store

0 commit comments

Comments
 (0)