Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include/internal/catch_exception_translator_registry.hpp
diff options
context:
space:
mode:
authorPhil Nash2015-12-04 10:19:08 +0000
committerPhil Nash2015-12-04 10:19:08 +0000
commitfdc42d0af47f58fa13a42b685bbeaf55a8347673 (patch)
tree779ff3d692eeffd33353d89ad7697a592ab5201e /include/internal/catch_exception_translator_registry.hpp
parentd758428fe297655e558a86cc6a013fcb1bcc8c7d (diff)
parentd274fc571c3980b5ac04cbe1416cf2205e6c99f7 (diff)
downloadcatch3-1.3.0.tar.gz
Merged from develop branchv1.3.0
- now v1.3.0
Diffstat (limited to 'include/internal/catch_exception_translator_registry.hpp')
-rw-r--r--include/internal/catch_exception_translator_registry.hpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/include/internal/catch_exception_translator_registry.hpp b/include/internal/catch_exception_translator_registry.hpp
index 29ddf8e7..c4bdb400 100644
--- a/include/internal/catch_exception_translator_registry.hpp
+++ b/include/internal/catch_exception_translator_registry.hpp
@@ -32,13 +32,13 @@ namespace Catch {
#ifdef __OBJC__
// In Objective-C try objective-c exceptions first
@try {
- throw;
+ return tryTranslators();
}
@catch (NSException *exception) {
return Catch::toString( [exception description] );
}
#else
- throw;
+ return tryTranslators();
#endif
}
catch( TestFailureException& ) {
@@ -54,20 +54,15 @@ namespace Catch {
return msg;
}
catch(...) {
- return tryTranslators( m_translators.begin() );
+ return "Unknown exception";
}
}
- std::string tryTranslators( std::vector<const IExceptionTranslator*>::const_iterator it ) const {
- if( it == m_translators.end() )
- return "Unknown exception";
-
- try {
- return (*it)->translate();
- }
- catch(...) {
- return tryTranslators( it+1 );
- }
+ std::string tryTranslators() const {
+ if( m_translators.empty() )
+ throw;
+ else
+ return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() );
}
private: