A failed Google Test assertion will throw an exception of this type when GTEST_FLAG(throw_on_failure) is true (if exceptions are enabled). We derive it from std::runtime_error, which is for errors presumably detectable only at run time. Since std::runtime_error inherits from std::exception, many testing frameworks know how to extract and print the message inside it.
| 3355 | // std::exception, many testing frameworks know how to extract and print the |
| 3356 | // message inside it. |
| 3357 | class GoogleTestFailureException : public ::std::runtime_error { |
| 3358 | public: |
| 3359 | explicit GoogleTestFailureException(const TestPartResult& failure) |
| 3360 | : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {} |
| 3361 | }; |
| 3362 | #endif // GTEST_HAS_EXCEPTIONS |
| 3363 | |
| 3364 | namespace internal { |
no outgoing calls