V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
4771314
V2EX  ›  Node.js

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

  •  
  •   4771314 · Oct 29, 2020 · 5361 views
    This topic created in 2005 days ago, the information mentioned may be changed or developed.
    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 的框架

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5947 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 03:32 · PVG 11:32 · LAX 20:32 · JFK 23:32
    ♥ Do have faith in what you're doing.