| 9180 | } // anon namespace |
| 9181 | |
| 9182 | Session::Session() { |
| 9183 | static bool alreadyInstantiated = false; |
| 9184 | if( alreadyInstantiated ) { |
| 9185 | try { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); } |
| 9186 | catch(...) { getMutableRegistryHub().registerStartupException(); } |
| 9187 | } |
| 9188 | |
| 9189 | const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); |
| 9190 | if ( !exceptions.empty() ) { |
| 9191 | m_startupExceptions = true; |
| 9192 | Colour colourGuard( Colour::Red ); |
| 9193 | Catch::cerr() << "Errors occurred during startup!" << '\n'; |
| 9194 | // iterate over all exceptions and notify user |
| 9195 | for ( const auto& ex_ptr : exceptions ) { |
| 9196 | try { |
| 9197 | std::rethrow_exception(ex_ptr); |
| 9198 | } catch ( std::exception const& ex ) { |
| 9199 | Catch::cerr() << Column( ex.what() ).indent(2) << '\n'; |
| 9200 | } |
| 9201 | } |
| 9202 | } |
| 9203 | |
| 9204 | alreadyInstantiated = true; |
| 9205 | m_cli = makeCommandLineParser( m_configData ); |
| 9206 | } |
| 9207 | Session::~Session() { |
| 9208 | Catch::cleanUp(); |
| 9209 | } |
nothing calls this directly
no test coverage detected