try catch block should be able to catch fetch block and instead it throws outside of the block
C:\Users\Windows\test\node_modules\node-fetch\lib\index.js:400
reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err));
^
FetchError: Invalid response body while trying to fetch https://<SOME_URL_HERE>: Premature close
at Gunzip.<anonymous> (C:\Users\Windows\test\node_modules\node-fetch\lib\index.js:400:12)
at Gunzip.emit (node:events:525:35)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
type: 'system',
errno: 'ERR_STREAM_PREMATURE_CLOSE',
code: 'ERR_STREAM_PREMATURE_CLOSE'
}
Node.js v18.16.1
I have opened related issue https://github.com/node-fetch/node-fetch/issues/1782 but I think it could be caused by using an old node-fetch version from cross-fetch version so opening an issue here as well
Reproduction
Steps to reproduce the behavior:
Expected behavior
try catch block should be able to catch fetch block and instead it throws outside of the block