Skip to content

Commit df0026c

Browse files
authoredJan 13, 2025··
fix: Dump stack on error when verbose (#6782)
1 parent ab2cdb8 commit df0026c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
 

‎packages/cspell/bin.mjs

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ import { format } from 'node:util';
33

44
import { CommanderError, program } from 'commander';
55

6-
import * as app from './dist/esm/app.mjs';
6+
import { ApplicationError, CheckFailed, run } from './dist/esm/app.mjs';
77

8-
app.run(program, process.argv).catch((e) => {
9-
if (!(e instanceof CommanderError) && !(e instanceof app.CheckFailed)) {
10-
const msg = e instanceof app.ApplicationError ? e.message : format(e);
8+
run(program, process.argv).catch((e) => {
9+
if (!(e instanceof CommanderError) && !(e instanceof CheckFailed)) {
10+
const verbose = process.argv.includes('--verbose') || process.argv.includes('-v');
11+
const msg = !verbose && e instanceof ApplicationError ? e.message : format(e);
1112
process.stdout.write(msg + '\n');
1213
// It is possible an explicit exit code was set, use it if it was.
1314
process.exitCode = process.exitCode || 1;
1415
}
15-
if (e instanceof app.CheckFailed) {
16+
if (e instanceof CheckFailed) {
1617
process.exitCode = e.exitCode;
1718
}
1819
});

0 commit comments

Comments
 (0)
Please sign in to comment.