Should unchecked exceptions be caught and dealt with?

后端 未结 6 1505
说谎
说谎 2020-12-17 05:00

I have been reading many posts about exceptions lately and I have a question whether unchecked exceptions should be caught. I have read that if you want your application to

6条回答
  •  既然无缘
    2020-12-17 05:22

    should you catch unchecked exceptions?

    Yes and No. Depends on what exception is thrown.

    Are unchecked exceptions ideally programming errors that you don't check for?

    You can write a catch block to catch unchecked exception but again depends whether you should. If you do then it's possible that a bug remain unsolved for a long time and by the time it is discovered it's size is also changed.

    Should they just bubble up from your application?

    If they occur, try to solve their cause (if it' spossible). Don't catch them always as Hard and Fast rule.

提交回复
热议问题