V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
4771314
V2EX  ›  Node.js

关于 process.on uncaughtException unhandledRejection 使用的疑问

  •  
  •   4771314 · 2020-10-29 17:33:42 +08:00 · 4668 次点击
    这是一个创建于 1268 天前的主题,其中的信息可能已经有所发展或是发生改变。
    process.on('uncaughtException',function name(error) {
        const msg = error ? Err.getThrowableMessage(error) : '未知错误';
        logger.error('全局异常 uncaughtException:' +  msg);
    });
    
    process.on('unhandledRejection',function name(error) {
        const msg = error ? Err.getThrowableMessage(error) : '未知错误';
        monitor.report(MONITOR.TEST_PORTRAIT_GLOBAL_REJECTION_COUNT);
    });
    

    server 需要用这种方式保证服务的稳定吗? 使用的是 koa 的框架

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   946 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 20:23 · PVG 04:23 · LAX 13:23 · JFK 16:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.