diff options
| author | Phil Nash | 2012-05-21 21:51:16 +0100 |
|---|---|---|
| committer | Phil Nash | 2012-05-21 21:51:16 +0100 |
| commit | 35b31fa78a74abc4f9e3ef31dd140b03935ca20c (patch) | |
| tree | d2fcd4bc24b65131e240627bf4869991a1c10e1e /include | |
| parent | 371db8b42fb2171ea2ab542a9875ddf4e3e8b8ea (diff) | |
| download | catch3-35b31fa78a74abc4f9e3ef31dd140b03935ca20c.tar.gz | |
Added support for Objective-C exceptions
Diffstat (limited to 'include')
| -rw-r--r-- | include/internal/catch_exception_translator_registry.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/internal/catch_exception_translator_registry.hpp b/include/internal/catch_exception_translator_registry.hpp index e80142f8..55a20713 100644 --- a/include/internal/catch_exception_translator_registry.hpp +++ b/include/internal/catch_exception_translator_registry.hpp @@ -10,6 +10,10 @@ #include "catch_interfaces_exception.h" +#ifdef __OBJC__ +#import "Foundation/Foundation.h" +#endif + namespace Catch { class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { @@ -24,7 +28,17 @@ namespace Catch { virtual std::string translateActiveException() const { try { +#ifdef __OBJC__ + // In Objective-C try objective-c exceptions first + @try { + throw; + } + @catch (NSException *exception) { + return toString( [exception description] ); + } +#else throw; +#endif } catch( std::exception& ex ) { return ex.what(); |