Skip to content

Commit

Permalink
fix: cspell4 #880
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed Jan 23, 2021
1 parent 57f8f9b commit 475a754
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
14 changes: 5 additions & 9 deletions packages/cspell/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
const app = require('./dist/app');
const program = require('commander');

function reject(e) {
app.run(program, process.argv).catch((e) => {
if (!(e instanceof program.CommanderError) && !(e instanceof app.CheckFailed)) {
console.log(e);
}
process.exit(1);
}

try {
app.run(program, process.argv).catch(reject);
} catch (e) {
reject(e);
}
if (e instanceof app.CheckFailed) {
process.exitCode = e.exitCode;
}
});
4 changes: 3 additions & 1 deletion packages/cspell/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ function formatIssue(template: string, issue: App.Issue) {
}

export class CheckFailed extends Error {
constructor(message: string, readonly _errorCode: number) {
readonly exitCode: number;
constructor(message: string, exitCode = 1) {
super(message);
this.exitCode = exitCode;
}
}

0 comments on commit 475a754

Please sign in to comment.