(error: unknown)
| 768 | } |
| 769 | |
| 770 | function formatFetchError(error: unknown): string { |
| 771 | if (error instanceof Error) { |
| 772 | const cause = |
| 773 | error.cause instanceof Error |
| 774 | ? `: ${error.cause.message || error.cause.name}` |
| 775 | : `` |
| 776 | return `${error.message || error.name || `Unknown error`}${cause}` |
| 777 | } |
| 778 | return String(error) || `Unknown error` |
| 779 | } |
| 780 | |
| 781 | async function toFetchRequest(req: IncomingMessage): Promise<Request> { |
| 782 | const body = await readBody(req) |