A type that is not derived from std::exception (and is thus unknown)
| 43 | |
| 44 | // A type that is not derived from std::exception (and is thus unknown) |
| 45 | class MyException3 { |
| 46 | public: |
| 47 | explicit MyException3(const char *m) : message{m} {} |
| 48 | virtual const char *what() const noexcept { return message.c_str(); } |
| 49 | // Rule of 5 BEGIN: to preempt compiler warnings. |
| 50 | MyException3(const MyException3 &) = default; |
| 51 | MyException3(MyException3 &&) = default; |
| 52 | MyException3 &operator=(const MyException3 &) = default; |
| 53 | MyException3 &operator=(MyException3 &&) = default; |
| 54 | virtual ~MyException3() = default; |
| 55 | // Rule of 5 END. |
| 56 | private: |
| 57 | std::string message = ""; |
| 58 | }; |
| 59 | |
| 60 | // A type that should be translated to MyException |
| 61 | // and delegated to its exception translator |
no outgoing calls