Skip to content

Commit 40f74b5

Browse files
committed
added catch and then
1 parent 1338edb commit 40f74b5

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

bin/helpers/reporterHTML.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,15 @@ function getReportResponse(filePath, fileName, reportJsonUrl) {
130130
writer.on('close', async () => {
131131
if (!error) {
132132
logger.debug("Unzipping downloaded html and json reports.");
133-
await unzipFile(filePath, fileName);
134-
fs.unlinkSync(tmpFilePath);
135-
logger.debug("Successfully prepared json and html reports.");
136-
resolve(true);
133+
unzipFile(filePath, fileName).then((msg) => {
134+
logger.debug(msg);
135+
fs.unlinkSync(tmpFilePath);
136+
logger.debug("Successfully prepared json and html reports.");
137+
resolve(true);
138+
}).catch((err) =>{
139+
logger.debug(`Unzipping html and json report failed. Error: ${err}`)
140+
reject(true);
141+
});
137142
}
138143
//no need to call the reject here, as it will have been called in the
139144
//'error' stream;
@@ -148,12 +153,11 @@ const unzipFile = async (filePath, fileName) => {
148153
await unzipper.Open.file(path.join(filePath, fileName))
149154
.then(d => d.extract({path: filePath, concurrency: 5}))
150155
.catch((err) => {
151-
logger.debug(`Unzipping html and json report failed. Error: ${err}`);
152156
reject(err);
153157
process.exitCode = Constants.ERROR_EXIT_CODE;
154158
});
155-
logger.debug("Unzipped the json and html successfully.")
156-
resolve();
159+
let message = "Unzipped the json and html successfully."
160+
resolve(message);
157161
});
158162
}
159163

0 commit comments

Comments
 (0)