forked from Echo-Mirror-Butler/echomirror-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.ts
More file actions
30 lines (27 loc) · 733 Bytes
/
Copy patherrors.ts
File metadata and controls
30 lines (27 loc) · 733 Bytes
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
export class EchoMirrorError extends Error {
constructor(
message: string,
public readonly statusCode?: number,
) {
super(message)
this.name = 'EchoMirrorError'
}
}
export class AuthError extends EchoMirrorError {
constructor(message = 'Authentication failed') {
super(message, 401)
this.name = 'AuthError'
}
}
export class NetworkError extends EchoMirrorError {
constructor(message = 'Network request failed') {
super(message)
this.name = 'NetworkError'
}
}
export class RateLimitError extends EchoMirrorError {
constructor(public readonly retryAfterSeconds: number) {
super(`Rate limit exceeded. Retry after ${retryAfterSeconds}s`, 429)
this.name = 'RateLimitError'
}
}