(code: ErrorCode | undefined)
| 126 | |
| 127 | /** Map an internal `MemosError.code` to a numeric JSON-RPC code we'll report. */ |
| 128 | export function rpcCodeForError(code: ErrorCode | undefined): number { |
| 129 | if (!code) return JSONRPC_INTERNAL_ERROR; |
| 130 | switch (code) { |
| 131 | case "invalid_argument": |
| 132 | case "config_invalid": |
| 133 | case "protocol_error": |
| 134 | return JSONRPC_INVALID_PARAMS; |
| 135 | case "unknown_method": |
| 136 | return JSONRPC_METHOD_NOT_FOUND; |
| 137 | default: |
| 138 | return JSONRPC_APPLICATION_ERROR; |
| 139 | } |
| 140 | } |
no outgoing calls
no test coverage detected