fix(entry): improve error message formatting
- Relocate `util.parseArgs()` inside the main function for cleaner scoping - Update `.catch` handlers in `index.ts` and `tts.ts` to wrap text to terminal width and colorize errors in red
This commit is contained in:
parent
f3146ab087
commit
56352d87ec
2 changed files with 33 additions and 25 deletions
5
tts.ts
5
tts.ts
|
|
@ -180,6 +180,9 @@ async function main() {
|
|||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
if ("message" in err) {
|
||||
const [columns] = process.stderr.getWindowSize();
|
||||
console.error(wrapAnsi(chalk.red(err.message), columns));
|
||||
} else console.log(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue