Skip to content

Commit

Permalink
chore: enhance unknown error logger (#4647)
Browse files Browse the repository at this point in the history
* fix: we can use console-trace to follow unknown error call stack

* chore: add changeset
  • Loading branch information
GiveMe-A-Name authored Sep 14, 2023
1 parent be6cb8f commit 843cb2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/slimy-seals-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modern-js/core': patch
---

fix(core): we should not pass it, if err is not instanceof Error.
fix(core): 如果 err 不属于错误,我们不应该直接丢弃它
4 changes: 4 additions & 0 deletions packages/cli/core/src/createCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ export const createCli = () => {
hooksRunner.beforeExit();
if (err instanceof Error) {
logger.error(err.stack);
} else {
// We should not pass it, if err is not instanceof Error.
// We can use `console.trace` to follow it call stack,
console.trace('Unknown Error', err);
}
process.nextTick(() => {
// eslint-disable-next-line no-process-exit
Expand Down

0 comments on commit 843cb2c

Please sign in to comment.