Skip to content

Commit e731b33

Browse files
authored
chore: handle promise rejection (#1869)
1 parent ef59cfc commit e731b33

File tree

1 file changed

+7
-2
lines changed
  • packages/webpack-cli/bin

1 file changed

+7
-2
lines changed

packages/webpack-cli/bin/cli.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require('v8-compile-cache');
55
const importLocal = require('import-local');
66
const runCLI = require('../lib/bootstrap');
77
const { yellow } = require('colorette');
8-
const { error } = require('../lib/utils/logger');
8+
const { error, info } = require('../lib/utils/logger');
99
const { packageExists, promptInstallation } = require('@webpack-cli/package-utils');
1010

1111
// Prefer the local installation of webpack-cli
@@ -20,6 +20,11 @@ if (packageExists('webpack')) {
2020
} else {
2121
promptInstallation('webpack', () => {
2222
error(`It looks like ${yellow('webpack')} is not installed.`);
23-
});
23+
})
24+
.then(() => info(`${yellow('webpack')} was installed sucessfully.`))
25+
.catch(() => {
26+
process.exitCode = 2;
27+
error(`Action Interrupted, Please try once again or install ${yellow('webpack')} manually.`);
28+
});
2429
return;
2530
}

0 commit comments

Comments
 (0)