C++ get description of an exception caught in catch(…) block

前端 未结 6 1891
感动是毒
感动是毒 2020-12-03 10:07

can I get description of an exception caught by

catch(...)

block? something like .what() of std::exception.

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-03 10:45

    How we have our exceptions implemented is that, we have our own Exception classes, that are all derived from std::exception..

    Our exceptions will contain Exception message, Function name, File name and line where exceptions are generated. These are all useful not just to show the Messages but also can be used for logging which helps to diagnose the Exception quite easily. So, we get the entire information about the Exceptions generated.

    Remember exceptions are for us to get information about what went wrong. So, every bit of information helps in this regard..

提交回复
热议问题