MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/TriangleMeshDistance / translateActiveException

Method translateActiveException

tests/catch.hpp:8377–8417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8375
8376#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
8377 std::string ExceptionTranslatorRegistry::translateActiveException() const {
8378 try {
8379#ifdef __OBJC__
8380 // In Objective-C try objective-c exceptions first
8381 @try {
8382 return tryTranslators();
8383 }
8384 @catch (NSException *exception) {
8385 return Catch::Detail::stringify( [exception description] );
8386 }
8387#else
8388 // Compiling a mixed mode project with MSVC means that CLR
8389 // exceptions will be caught in (...) as well. However, these
8390 // do not fill-in std::current_exception and thus lead to crash
8391 // when attempting rethrow.
8392 // /EHa switch also causes structured exceptions to be caught
8393 // here, but they fill-in current_exception properly, so
8394 // at worst the output should be a little weird, instead of
8395 // causing a crash.
8396 if (std::current_exception() == nullptr) {
8397 return "Non C++ exception. Possibly a CLR exception.";
8398 }
8399 return tryTranslators();
8400#endif
8401 }
8402 catch( TestFailureException& ) {
8403 std::rethrow_exception(std::current_exception());
8404 }
8405 catch( std::exception& ex ) {
8406 return ex.what();
8407 }
8408 catch( std::string& msg ) {
8409 return msg;
8410 }
8411 catch( const char* msg ) {
8412 return msg;
8413 }
8414 catch(...) {
8415 return "Unknown exception";
8416 }
8417 }
8418
8419 std::string ExceptionTranslatorRegistry::tryTranslators() const {
8420 if (m_translators.empty()) {

Callers 1

translateActiveExceptionFunction · 0.80

Calls 2

stringifyFunction · 0.85
whatMethod · 0.80

Tested by

no test coverage detected