Catch all unhandled javascript promise rejections

后端 未结 4 681
青春惊慌失措
青春惊慌失措 2020-11-27 05:01

I would like to catch all unhandled exceptions/rejections that take place within a javascript Promise. Is there a good method for catching them without adding a .catch

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 05:39

    uncaught library can help you to catch unhandled promise rejections.

    And it handles uncaught errors as well.

    EDIT

    
    
    
    

    Benefit of this approach is the only one interface, which allows you to handle both uncaught errors and unhandled promise rejections.

提交回复
热议问题