OnUncaughtException

注册捕获全局未捕获异常的处理器。(默认启用)

Import name: Sentry.onUncaughtExceptionIntegration

此集成默认启用。如果您想修改默认集成,请阅读此文档

onUncaughtExceptionIntegration 注册处理器以捕获会导致进程退出的全局未捕获异常。

此集成 不会 阻止进程退出!如果您希望阻止进程退出,您应该注册自己的未捕获异常处理器,并在集成选项中配置 exitEvenIfOtherHandlersAreRegistered: false

Copied
Sentry.init({
  integrations: [Sentry.onUncaughtExceptionIntegration()],
});

Type: boolean

如果设置为 false,当检测到已注册其他未捕获异常处理器时,SDK 不会 退出。

Type: (firstError: Error, secondError: Error | undefined) => void

当未捕获的错误会导致进程退出时调用此方法。如果处理器被多次调用,secondError 将被设置。这可能是因为 onFatalError 自身抛出了异常,或者是在 onFatalError 运行时其他地方发生了独立的错误。