Skip to content

Commit 8019c61

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 2f10632 commit 8019c61

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
@@ -76,6 +76,18 @@ export class BlobError extends ErrorReply {}
7676

7777
export class TimeoutError extends Error {}
7878

79+
export class SocketTimeoutDuringMaintananceError extends TimeoutError {
80+
constructor(timeout: number) {
81+
super(`Socket timeout during maintenance. Expecting data, but didn't receive any in ${timeout}ms.`);
82+
}
83+
}
84+
85+
export class CommandTimeoutDuringMaintananceError extends TimeoutError {
86+
constructor(timeout: number) {
87+
super(`Command timeout during maintenance. Waited to write command for more than ${timeout}ms.`);
88+
}
89+
}
90+
7991
export class MultiErrorReply extends ErrorReply {
8092
replies: Array<ErrorReply>;
8193
errorIndexes: Array<number>;

0 commit comments

Comments
 (0)