mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 23:36:11 +01:00
Replace throw; with std::rethrow_exception(std::current_exception());
This works around a bug in libcxxrt handling of active exception count that caused std::uncaught_exception() to return true even if there was none. Closes #1028
This commit is contained in:
parent
11918b76d0
commit
70e0d48978
@ -37,7 +37,7 @@ namespace Catch {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
catch( TestFailureException& ) {
|
catch( TestFailureException& ) {
|
||||||
throw;
|
std::rethrow_exception(std::current_exception());
|
||||||
}
|
}
|
||||||
catch( std::exception& ex ) {
|
catch( std::exception& ex ) {
|
||||||
return ex.what();
|
return ex.what();
|
||||||
@ -55,7 +55,7 @@ namespace Catch {
|
|||||||
|
|
||||||
std::string ExceptionTranslatorRegistry::tryTranslators() const {
|
std::string ExceptionTranslatorRegistry::tryTranslators() const {
|
||||||
if( m_translators.empty() )
|
if( m_translators.empty() )
|
||||||
throw;
|
std::rethrow_exception(std::current_exception());
|
||||||
else
|
else
|
||||||
return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() );
|
return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() );
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
static std::string translatorName( signature )
|
static std::string translatorName( signature )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ namespace Catch {
|
|||||||
std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {
|
std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {
|
||||||
try {
|
try {
|
||||||
if( it == itEnd )
|
if( it == itEnd )
|
||||||
throw;
|
std::rethrow_exception(std::current_exception());
|
||||||
else
|
else
|
||||||
return (*it)->translate( it+1, itEnd );
|
return (*it)->translate( it+1, itEnd );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user