Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: support ignoreCode #13

Merged
merged 1 commit into from
Sep 22, 2022
Merged

feat: support ignoreCode #13

merged 1 commit into from
Sep 22, 2022

Conversation

hyj1991
Copy link
Member

@hyj1991 hyj1991 commented Sep 22, 2022

背景

在目前 async/await + promise 的 Node 开发模式下,非 stream / socket 基本不会出现 uncaughtException 的问题,而对于 stream / socket 涉及到 fd 操作的错误,譬如:

[Error: EBADF: bad file descriptor, write] {
  errno: -9,
  code: 'EBADF',
  syscall: 'write',
  name: 'EBADFError'
}
Error: EBADF: bad file descriptor, write

类似这种没有任何可回溯的有用堆栈信息的 uncaughtException 造成 graceful 触发进程退出,反而会影响到主业务流程的状态。

故此 PR 旨在支持上层开发者定义可忽略(即进程不退出)的错误码,当匹配到传入的 ignoreCode 配置错误码,graceful 只会输出原始的错误信息,而不会执行后续的退出逻辑。

@fengmk2 fengmk2 merged commit e571409 into node-modules:master Sep 22, 2022
@fengmk2
Copy link
Member

fengmk2 commented Sep 22, 2022

我发个版本。

@fengmk2
Copy link
Member

fengmk2 commented Sep 22, 2022

1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants