Skip to content

Commit 39167e7

Browse files
committed
fix: throw IdempotencyUnknownError for invalid record status in RedisPersistenceLayer
1 parent 9d007df commit 39167e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/idempotency/src/persistence/RedisPersistenceLayer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
IdempotencyItemNotFoundError,
77
IdempotencyPersistenceConnectionError,
88
IdempotencyPersistenceConsistencyError,
9+
IdempotencyUnknownError,
910
} from '../errors.js';
1011
import type { IdempotencyRecordStatusValue } from '../types/IdempotencyRecord.js';
1112
import type {
@@ -130,7 +131,7 @@ class RedisPersistenceLayer extends BasePersistenceLayer {
130131
if (record.getStatus() === IdempotencyRecordStatus.INPROGRESS) {
131132
await this.#putInProgressRecord(record);
132133
} else {
133-
throw new Error(
134+
throw new IdempotencyUnknownError(
134135
'Only INPROGRESS records can be inserted with _putRecord'
135136
);
136137
}

0 commit comments

Comments
 (0)