Skip to content

Commit e25b810

Browse files
committed
fix(doctor): fix error handling in setup checks
closes #174
1 parent 111e599 commit e25b810

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/commands/doctor/checks/setup.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,28 @@ module.exports = [{
3636
})
3737
}], {concurrent: true, renderer: context.verbose ? context.renderer : 'silent', exitOnError: false})
3838
.run(context).catch(() => {
39-
let errors = [];
39+
let missing = [];
4040

4141
if (!context.systemd) {
42-
errors.push('systemd');
42+
missing.push('systemd');
4343
}
4444

4545
if (!context.nginx) {
46-
errors.push('nginx');
46+
missing.push('nginx');
4747
}
4848

49-
if (errors.length) {
50-
return Promise.reject(new errors.SystemError(chalk.yellow(`Missing package(s): ${errors.join(', ')}`)));
49+
if (missing.length) {
50+
return Promise.reject(new errors.SystemError(chalk.yellow(`Missing package(s): ${missing.join(', ')}`)));
5151
}
5252
});
5353
}).catch((error) => {
5454
// If the error caught is not a SystemError, something went wrong with execa,
5555
// so throw a ProcessError instead
5656
if (!(error instanceof errors.SystemError)) {
57-
return Promise.reject(new errors.ProcessError(error));
57+
error = new errors.ProcessError(error);
5858
}
59+
60+
return Promise.reject(error);
5961
});
6062
}
6163
}];

0 commit comments

Comments
 (0)