Skip to content

Commit dd7ceb2

Browse files
committed
fix: handle promise rejections within stream CB
1 parent 63e9602 commit dd7ceb2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

bin/helpers/buildArtifacts.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,15 @@ const downloadAndUnzip = async (filePath, fileName, url) => {
121121
reject(err);
122122
});
123123
writer.on('close', async () => {
124-
if (!error) {
125-
await unzipFile(filePath, fileName);
126-
fs.unlinkSync(tmpFilePath);
127-
resolve(true);
124+
try {
125+
if (!error) {
126+
await unzipFile(filePath, fileName);
127+
fs.unlinkSync(tmpFilePath);
128+
}
129+
} catch (error) {
130+
reject(error);
128131
}
129-
//no need to call the reject here, as it will have been called in the
130-
//'error' stream;
132+
resolve(true);
131133
});
132134
}
133135
});

0 commit comments

Comments
 (0)