summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-02-21 20:07:14 +0100
committerMatthias Beyer <mail@beyermatthias.de>2016-02-21 20:27:23 +0100
commit6baa3c7f38d2f7d134ff034ca22ea36a4b71da24 (patch)
tree535cd1e6eb4cd14bde8dbce0ffdf503f8bd14645 /doc
parent3e18a6df6c5f26bf04b6383e00c8debb1b08b7e6 (diff)
doc: libimagutil: Add error-tracing utility documentation
Diffstat (limited to 'doc')
-rw-r--r--doc/src/03000-lib-util.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/src/03000-lib-util.md b/doc/src/03000-lib-util.md
index d31eb4f5..42b128c2 100644
--- a/doc/src/03000-lib-util.md
+++ b/doc/src/03000-lib-util.md
@@ -27,5 +27,29 @@ respectively. The implementation is realized via Regex.
The `KeyValue` type implementes `Into<(K, V)>` for convenience.
+## Error tracing {#sec:libutil:errortrace}
+The error tracing functions are functions which help printing an error chain
+to the user.
+
+It allows to trace nested errors like @lst:errtrace:exampleerror to the user
+in a backtrace-ish way (@lst:errtrace:exampletrace).
+
+```{#lst:errtrace:exampleerror.rust .numberLines caption="Error chain"}
+ErrA::new(a_errorkind,
+ Some(Box::new(ErrB::new(b_errorkind,
+ Some(Box::new(ErrC::new(c_errorkind,
+ None)))
+ )))
+ )
+```
+
+The variants of the function allow limiting the trace to a certain depth or
+printing the error trace to the debug output stream.
+
+```{#lst:errtrace:exampletrace .numberLines caption="Error trace"}
+[Error][c_errorkind]: Some C-error text -- caused:
+[Error][b_errorkind]: Some B-error text -- caused:
+[Error][a_errorkind]: Some A-error text
+```