Skip to content

Commit b97f307

Browse files
committed
feat(errors): Add specialized timeout error types for maintenance scenarios
- Added `SocketTimeoutDuringMaintananceError`, a subclass of `TimeoutError`, to handle socket timeouts during maintenance. - Added `CommandTimeoutDuringMaintananceError`, another subclass of `TimeoutError`, to address command write timeouts during maintenance.
1 parent 6ad4c68 commit b97f307

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/client/lib/errors.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ export class BlobError extends ErrorReply {}
7171

7272
export class TimeoutError extends Error {}
7373

74+
export class SocketTimeoutDuringMaintananceError extends TimeoutError {
75+
constructor(timeout: number) {
76+
super(`Socket timeout during maintenance. Expecting data, but didn't receive any in ${timeout}ms.`);
77+
}
78+
}
79+
80+
export class CommandTimeoutDuringMaintananceError extends TimeoutError {
81+
constructor(timeout: number) {
82+
super(`Command timeout during maintenance. Waited to write command for more than ${timeout}ms.`);
83+
}
84+
}
85+
7486
export class MultiErrorReply extends ErrorReply {
7587
replies: Array<ErrorReply>;
7688
errorIndexes: Array<number>;

0 commit comments

Comments
 (0)