Skip to content

Handle connection errors more elegantly #1

@aleclarson

Description

@aleclarson

The current error message is bad:

(node:19992) UnhandledPromiseRejectionWarning: FetchError: request to https://unpkg.com/modern-normalize@1.0.0/modern-normalize.css failed, reason: getaddrinfo ENOTFOUND unpkg.com
    at ClientRequest.<anonymous> (~/dev/vite-plugin-rehost/node_modules/.pnpm/node-fetch@2.6.1/node_modules/node-fetch/lib/index.js:1461:11)
    at ClientRequest.emit (events.js:314:20)
    at TLSSocket.socketErrorListener (_http_client.js:469:9)
    at TLSSocket.emit (events.js:314:20)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
(node:19992) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions