fix: console error ERR_STREAM_PREMATURE_CLOSE #670
Massimo Melina committed
Jul 7, 2024 at 00:14 UTC
31d195f3cad18cec1c6d93064077874a7c151bbd
1 file changed
+1
src/index.ts
+1
@@ -57,6 +57,7 @@ function errorHandler(err:Error & { code:string, path:string }) {
57
if (DEV && code === 'ENOENT' && err.path.endsWith('sockjs-node')) return // spam out dev stuff
58
if (code === 'ECANCELED' || code === 'ECONNRESET' || code === 'ECONNABORTED' || code === 'EPIPE'
59
|| code === 'ERR_STREAM_WRITE_AFTER_END' // happens disconnecting uploads, don't care
60
+ || code === 'ERR_STREAM_PREMATURE_CLOSE' // happens when many files are sent (not locally), but I checked that the files are written completely. Introduced after node18.5.0 and is thrown by pipeline() used by PUT method handler.
61
|| code === 'HPE_INVALID_METHOD' // cannot serve you like that
62
|| code === 'HPE_INVALID_EOF_STATE') return // someone interrupted, don't care
63
console.error(new Date().toLocaleString('en-uk'), 'server error', err)