(body: string)
| 88 | |
| 89 | /** One JSON-RPC error shape, or null when the body is not the protocol envelope. */ |
| 90 | const jsonRpcError = (body: string): { readonly code: number; readonly message: string } | null => { |
| 91 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- test helper: a non-JSON body is itself the signal we assert on |
| 92 | try { |
| 93 | const parsed = JSON.parse(body) as { |
| 94 | readonly jsonrpc?: string; |
| 95 | readonly error?: { readonly code?: number; readonly message?: string }; |
| 96 | }; |
| 97 | if (parsed.jsonrpc !== "2.0" || typeof parsed.error?.code !== "number") return null; |
| 98 | return { code: parsed.error.code, message: parsed.error.message ?? "" }; |
| 99 | } catch { |
| 100 | return null; |
| 101 | } |
| 102 | }; |
| 103 | |
| 104 | /** |
| 105 | * The verdict a request gets once the destroy alarm has wiped the session's |
no outgoing calls
no test coverage detected