Is “Dying is Awesome” preferred?

后端 未结 16 799
栀梦
栀梦 2020-12-08 11:09

Recently I attended Jeffrey Richter\'s training courses about .NET. He mentions one strategy of coding \"Dying is awesome\". That is, don\'t write \"catch (Exception ex)\" e

16条回答
  •  隐瞒了意图╮
    2020-12-08 11:38

    I am not familiar with Richter's material, but I think the philosophy/justification is that in the vast majority of cases there is really nothing that the program can do to recover from an unhandled and unexpected exception.

    Letting the program die in front of a user, however, is not a very good idea - it leaves a very bad impression. I prefer to log unhandled exceptions to a database, notify the developers, and track them to make sure that they get fixed.

    Then again, I sell a product for exactly that purpose, so I am a bit biased in this area!

提交回复
热议问题