Add error handler to download stream lovell/sharp-libvips#14

This commit is contained in:
Lovell Fuller 2018-12-08 13:56:05 +00:00
parent 34d5252242
commit a2aa7d69e7

View File

@ -79,7 +79,9 @@ try {
if (response.statusCode !== 200) {
throw new Error(`Status ${response.statusCode}`);
}
response.pipe(tmpFile);
response
.on('error', fail)
.pipe(tmpFile);
});
tmpFile
.on('error', fail)