exception
# 介绍
捕获异常模块。主进程和childJob功能已经启用。
# 使用方法
const {
loadException,
uncaughtExceptionHandler,
unhandledRejectionHandler,
uncaughtExceptionMonitorHandler
} = require('ee-core/exception');
# API列表
# loadException()
开启异常捕获。会同时调用 uncaughtExceptionHandler() / unhandledRejectionHandler()
loadException();
# uncaughtExceptionHandler()
当进程上抛出异常而没有被捕获时触发该事件,并且使异常静默
# unhandledRejectionHandler()
当promise中reject的异常在同步任务中没有使用catch捕获就会触发该事件,即便是在异步情况下使用了catch也会触发该事件。
上次更新: 2025/04/10, 03:07:49