| 15 | } |
| 16 | |
| 17 | export class CodeError extends Error implements CodeMessage { |
| 18 | public static fromJson(json: CodeMessage): CodeError { |
| 19 | return new CodeError( |
| 20 | json.code, |
| 21 | json.message, |
| 22 | ); |
| 23 | } |
| 24 | |
| 25 | public code: number | string; |
| 26 | public message: string; |
| 27 | |
| 28 | constructor(code: number | string, message?: string) { |
| 29 | super(message); |
| 30 | this.code = code; |
| 31 | this.message = message || ""; |
| 32 | } |
| 33 | |
| 34 | public toJson(): CodeMessageWithClass { |
| 35 | return { |
| 36 | class: "CodeError", |
| 37 | code: this.code, |
| 38 | message: this.message, |
| 39 | }; |
| 40 | } |
| 41 | } |
nothing calls this directly
no outgoing calls
no test coverage detected