When the connection is closed by the server with an EPIPE an UnhandledPromiseRejectionWarning is thrown with
(node:39306) UnhandledPromiseRejectionWarning: RequestError: write EPIPE
at ClientRequest.<anonymous> (/Users/redacted/redacted/redacted/node_modules/got/dist/source/core/index.js:764:25)
at Object.onceWrapper (events.js:417:26)
at ClientRequest.emit (events.js:322:22)
at ClientRequest.origin.emit (/Users/redacted/redacted/redacted/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:310:20)
at errorOrDestroy (internal/streams/destroy.js:108:12)
at onwriteError (_stream_writable.js:424:5)
at onwrite (_stream_writable.js:445:5)
at internal/streams/destroy.js:50:7
at TLSSocket.Socket._destroy (net.js:677:5)
at TLSSocket.destroy (internal/streams/destroy.js:38:8)
at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:93:12)
at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)
(node:39306) 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: 1)
The message is:
RequestError: Cannot read property 'method' of undefined
Expected behavior
As in GOT 10 the error should be propagated but without an UnhandledPromiseRejectionWarning
Code to reproduce
I really do know how to reproduce it since is happening only on my home network, but still i think it should not throw an UnhandledPromiseRejectionWarning.
Checklist
[x] I have read the documentation.
[x] I have tried my code with the latest version of Node.js and Got.
Describe the bug
Actual behavior
When the connection is closed by the server with an EPIPE an UnhandledPromiseRejectionWarning is thrown with
The message is:
Expected behavior
As in GOT 10 the error should be propagated but without an UnhandledPromiseRejectionWarning
Code to reproduce
I really do know how to reproduce it since is happening only on my home network, but still i think it should not throw an UnhandledPromiseRejectionWarning.
Checklist