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

summaryrefslogtreecommitdiffhomepage
path: root/docs/tostring.md
diff options
context:
space:
mode:
authorPhil Nash2015-12-04 10:19:08 +0000
committerPhil Nash2015-12-04 10:19:08 +0000
commitfdc42d0af47f58fa13a42b685bbeaf55a8347673 (patch)
tree779ff3d692eeffd33353d89ad7697a592ab5201e /docs/tostring.md
parentd758428fe297655e558a86cc6a013fcb1bcc8c7d (diff)
parentd274fc571c3980b5ac04cbe1416cf2205e6c99f7 (diff)
downloadcatch3-1.3.0.tar.gz
Merged from develop branchv1.3.0
- now v1.3.0
Diffstat (limited to 'docs/tostring.md')
-rw-r--r--docs/tostring.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/tostring.md b/docs/tostring.md
index 1f801b3a..dbb6cb8d 100644
--- a/docs/tostring.md
+++ b/docs/tostring.md
@@ -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)