Translate exceptions by const reference instead of plain ref

This commit is contained in:
Martin Hořeňovský
2020-05-19 21:23:35 +02:00
parent 4b2f1da02a
commit 4394d3ae65
3 changed files with 8 additions and 8 deletions

View File

@@ -64,7 +64,7 @@ namespace Catch {
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:
```cpp
CATCH_TRANSLATE_EXCEPTION( MyType& ex ) {
CATCH_TRANSLATE_EXCEPTION( MyType const& ex ) {
return ex.message();
}
```