MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / translateActiveException

Method translateActiveException

extlibs/catch/include/catch/catch.hpp:10305–10345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10303
10304#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
10305 std::string ExceptionTranslatorRegistry::translateActiveException() const {
10306 try {
10307#ifdef __OBJC__
10308 // In Objective-C try objective-c exceptions first
10309 @try {
10310 return tryTranslators();
10311 }
10312 @catch (NSException *exception) {
10313 return Catch::Detail::stringify( [exception description] );
10314 }
10315#else
10316 // Compiling a mixed mode project with MSVC means that CLR
10317 // exceptions will be caught in (...) as well. However, these
10318 // do not fill-in std::current_exception and thus lead to crash
10319 // when attempting rethrow.
10320 // /EHa switch also causes structured exceptions to be caught
10321 // here, but they fill-in current_exception properly, so
10322 // at worst the output should be a little weird, instead of
10323 // causing a crash.
10324 if (std::current_exception() == nullptr) {
10325 return "Non C++ exception. Possibly a CLR exception.";
10326 }
10327 return tryTranslators();
10328#endif
10329 }
10330 catch( TestFailureException& ) {
10331 std::rethrow_exception(std::current_exception());
10332 }
10333 catch( std::exception& ex ) {
10334 return ex.what();
10335 }
10336 catch( std::string& msg ) {
10337 return msg;
10338 }
10339 catch( const char* msg ) {
10340 return msg;
10341 }
10342 catch(...) {
10343 return "Unknown exception";
10344 }
10345 }
10346
10347 std::string ExceptionTranslatorRegistry::tryTranslators() const {
10348 if (m_translators.empty()) {

Callers 1

translateActiveExceptionFunction · 0.80

Calls 2

stringifyFunction · 0.85
whatMethod · 0.45

Tested by

no test coverage detected