exception translators considered even for types deriving from std::exception, now

- also added docs for exception translators
- updated approvals
This commit is contained in:
Phil Nash
2015-11-18 08:39:21 +00:00
parent ed6e9128a4
commit a49f088032
8 changed files with 101 additions and 28 deletions

View File

@@ -55,6 +55,16 @@ namespace Catch {
}
```
## Exceptions
By default all exceptions deriving from `std::exception` will be translated to strings by calling the `what()` method. For exception types that do not derive from `std::exception` - or if `what()` does not return a suitable string - use `CATCH_TRANSLATE_EXCEPTION`. This defines a function that takes your exception type, by reference, and returns a string. It can appear anywhere in the code - it doesn't have to be in the same translation unit. For example:
```
CATCH_TRANSLATE_EXCEPTION( MyType& ex ) {
return ex.message();
}
```
---
[Home](Readme.md)