feat(cli): improve error handling with more custom Error instances
This commit is contained in:
parent
8dadfe9a5b
commit
30a448b4cf
6 changed files with 123 additions and 21 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env node
|
||||
import process from 'node:process';
|
||||
import { parseArgs } from 'node:util';
|
||||
import { ShowUsageError } from './show-usage-error.js';
|
||||
import { ShowUsageError } from './errors.js';
|
||||
import { getConfig } from './get-config.js';
|
||||
|
||||
type Action = (args: string[]) => Promise<void>;
|
||||
|
|
@ -208,7 +208,7 @@ try {
|
|||
if (error instanceof Error) {
|
||||
console.error(error.message);
|
||||
if (error.cause instanceof Error) {
|
||||
console.error(error.cause.message);
|
||||
console.error(error.cause.stack);
|
||||
}
|
||||
} else {
|
||||
console.error(error);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue