-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy patherror.ts
36 lines (34 loc) · 893 Bytes
/
error.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
interface Options {
exit?: number
original?: Error | undefined
code?: string | number
requestId?: string
action?: string
meta?: Record<string, any>
}
export class CloudBaseError extends Error {
readonly exit: number
readonly message: string
readonly name = 'CloudBaseError'
readonly original: Error | undefined
readonly code: string | number
readonly requestId: string
readonly action: string
readonly meta: any
constructor(message: string, options: Options = {}) {
super()
this.message = message
const {
code = '',
action = '',
original = null,
requestId = '',
meta = {}
} = options
this.original = original
this.code = code
this.requestId = requestId
this.action = action
this.meta = meta
}
}