Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Dump stack on error when verbose #6782

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/cspell/bin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ import { format } from 'node:util';

import { CommanderError, program } from 'commander';

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

app.run(program, process.argv).catch((e) => {
if (!(e instanceof CommanderError) && !(e instanceof app.CheckFailed)) {
const msg = e instanceof app.ApplicationError ? e.message : format(e);
run(program, process.argv).catch((e) => {
if (!(e instanceof CommanderError) && !(e instanceof CheckFailed)) {
const verbose = process.argv.includes('--verbose') || process.argv.includes('-v');
const msg = !verbose && e instanceof ApplicationError ? e.message : format(e);
process.stdout.write(msg + '\n');
// It is possible an explicit exit code was set, use it if it was.
process.exitCode = process.exitCode || 1;
}
if (e instanceof app.CheckFailed) {
if (e instanceof CheckFailed) {
process.exitCode = e.exitCode;
}
});
Loading