( body: unknown, code: number, message: string, )
| 353 | } |
| 354 | |
| 355 | function jsonRpcError( |
| 356 | body: unknown, |
| 357 | code: number, |
| 358 | message: string, |
| 359 | ): Record<string, unknown> { |
| 360 | // Preserve the request id when we can identify it; otherwise null. |
| 361 | const id = |
| 362 | body && typeof body === "object" && "id" in body |
| 363 | ? (body as { id: unknown }).id |
| 364 | : null; |
| 365 | return { jsonrpc: "2.0", id, error: { code, message } }; |
| 366 | } |
| 367 | |
| 368 | /** |
| 369 | * Start the HTTP server on `port`. Returns a closer that stops the listener — |
no outgoing calls
no test coverage detected