| 9096 | } // namespace |
| 9097 | |
| 9098 | Session::Session() { |
| 9099 | static bool alreadyInstantiated = false; |
| 9100 | if (alreadyInstantiated) { |
| 9101 | try { |
| 9102 | CATCH_INTERNAL_ERROR("Only one instance of Catch::Session can ever be used"); |
| 9103 | } catch (...) { |
| 9104 | getMutableRegistryHub().registerStartupException(); |
| 9105 | } |
| 9106 | } |
| 9107 | |
| 9108 | const auto &exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); |
| 9109 | if (!exceptions.empty()) { |
| 9110 | m_startupExceptions = true; |
| 9111 | Colour colourGuard(Colour::Red); |
| 9112 | Catch::cerr() << "Errors occurred during startup!" << '\n'; |
| 9113 | // iterate over all exceptions and notify user |
| 9114 | for (const auto &ex_ptr : exceptions) { |
| 9115 | try { |
| 9116 | std::rethrow_exception(ex_ptr); |
| 9117 | } catch (std::exception const &ex) { |
| 9118 | Catch::cerr() << Column(ex.what()).indent(2) << '\n'; |
| 9119 | } |
| 9120 | } |
| 9121 | } |
| 9122 | |
| 9123 | alreadyInstantiated = true; |
| 9124 | m_cli = makeCommandLineParser(m_configData); |
| 9125 | } |
| 9126 | Session::~Session() { |
| 9127 | Catch::cleanUp(); |
| 9128 | } |
nothing calls this directly
no test coverage detected