Global Exception Handlers in Java

后端 未结 2 1706
梦谈多话
梦谈多话 2021-02-09 07:04

I am thinking of setting up a global, default Exception handler for my (Android) Mobile application(which uses Java syntax) using Thread.setDefaultUncaughtExceptionHandler

2条回答
  •  暖寄归人
    2021-02-09 07:25

    One possible problem with creating a global exception handler is you may get stuck in a loop of exceptions - some exceptions will be thrown repeatedly unless a program is terminated.

    If you mean that when an exception is thrown, a message is displayed then the app is terminated, then you'll be fine.

提交回复
热议问题