| 8 | #include <string> |
| 9 | |
| 10 | class RootException : public std::exception |
| 11 | { |
| 12 | public: |
| 13 | RootException(char const * what, std::string const & msg); |
| 14 | |
| 15 | virtual ~RootException() noexcept = default; |
| 16 | |
| 17 | std::string const & Msg() const { return m_msg; } |
| 18 | |
| 19 | // std::exception overrides: |
| 20 | char const * what() const noexcept override { return m_whatWithAscii.c_str(); } |
| 21 | |
| 22 | private: |
| 23 | std::string m_whatWithAscii; |
| 24 | std::string m_msg; |
| 25 | }; |
| 26 | |
| 27 | template <typename Fn, typename... Args> |
| 28 | std::invoke_result_t<Fn &&, Args &&...> ExceptionCatcher(std::string const & comment, bool & exceptionWasThrown, |
no outgoing calls