| 19 | } |
| 20 | |
| 21 | export class AgentRPCAPIError extends Error { |
| 22 | constructor(message: string, response: unknown) { |
| 23 | let msg = message; |
| 24 | |
| 25 | if (response instanceof Error) { |
| 26 | msg += `\n${response.message}`; |
| 27 | } else if (typeof response === "string") { |
| 28 | msg += `\n${response}`; |
| 29 | } else if (typeof response === "object") { |
| 30 | msg += `\n${JSON.stringify(response)}`; |
| 31 | } |
| 32 | |
| 33 | super(msg); |
| 34 | this.name = "InferableAPIError"; |
| 35 | } |
| 36 | } |
nothing calls this directly
no outgoing calls
no test coverage detected