-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy patherrors.ts
84 lines (70 loc) · 1.92 KB
/
errors.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { RedisCommandRawReply } from './commands';
export class AbortError extends Error {
constructor() {
super('The command was aborted');
}
}
export class WatchError extends Error {
constructor() {
super('One (or more) of the watched keys has been changed');
}
}
export class ConnectionTimeoutError extends Error {
constructor() {
super('Connection timeout');
}
}
export class ClientClosedError extends Error {
constructor() {
super('The client is closed');
}
}
export class ClientOfflineError extends Error {
constructor() {
super('The client is offline');
}
}
export class DisconnectsClientError extends Error {
constructor() {
super('Disconnects client');
}
}
export class SocketClosedUnexpectedlyError extends Error {
constructor() {
super('Socket closed unexpectedly');
}
}
export class RootNodesUnavailableError extends Error {
constructor() {
super('All the root nodes are unavailable');
}
}
export class ReconnectStrategyError extends Error {
originalError: Error;
socketError: unknown;
constructor(originalError: Error, socketError: unknown) {
super(originalError.message);
this.originalError = originalError;
this.socketError = socketError;
}
}
export class ErrorReply extends Error {
constructor(message: string) {
super(message);
this.stack = undefined;
}
}
export class MultiErrorReply extends ErrorReply {
replies;
errorIndexes;
constructor(replies: Array<RedisCommandRawReply | ErrorReply>, errorIndexes: Array<number>) {
super(`${errorIndexes.length} commands failed, see .replies and .errorIndexes for more information`);
this.replies = replies;
this.errorIndexes = errorIndexes;
}
*errors() {
for (const index of this.errorIndexes) {
yield this.replies[index];
}
}
}