Skip to content

Commit ad5a485

Browse files
committed
merge from master
1 parent ca718f0 commit ad5a485

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

cli.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,14 @@ module.exports = async () => {
3232
} catch (err) {
3333
await fs.remove(tempDir);
3434
if (err.code === "ETARGET") {
35-
spinner.fail(
36-
chalk.red(
37-
`version '${err.wanted}' not found in npm registry\navailable versions:`
38-
)
35+
const msg = chalk.red(
36+
`version '${err.wanted}' not found in npm registry\navailable versions:\n`
3937
);
40-
console.log(err.versions.reverse().join(" | "));
41-
process.exit(1);
42-
} /* istanbul ignore next */ else {
43-
spinner.fail("Unexpected error");
44-
console.error(err);
45-
process.exit(-1);
38+
spinner.fail(msg + err.versions.reverse().join(" | "));
39+
throw err.code;
4640
}
47-
return;
41+
spinner.fail("Unexpected error");
42+
throw new Error(err);
4843
}
4944
await fs.copy(tempDir + "/dist", targetDir);
5045
await fs.remove(tempDir);

0 commit comments

Comments
 (0)