mirror of
https://github.com/haraldh/chainerror.git
synced 2025-06-08 00:44:42 +02:00
doc update
generated from commit 837c7980e8a5b84be28825303faac0ba28e53446
This commit is contained in:
parent
991a7a0786
commit
188d93a86a
15 changed files with 116 additions and 18 deletions
|
@ -140,7 +140,10 @@
|
|||
|
||||
<div id="content" class="content">
|
||||
<main>
|
||||
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
|
||||
<a class="header" href="#the-source-of-errors" id="the-source-of-errors"><h2>The source() of Errors</h2></a>
|
||||
<p>Sometimes you want to inspect the <code>source()</code> of an <code>Error</code>.
|
||||
<code>chainerror</code> implements <code>std::error::Error::source()</code>, so you can get the cause of an error.</p>
|
||||
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::result::Result;
|
||||
|
@ -452,6 +455,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# }
|
||||
# }
|
||||
</code></pre></pre>
|
||||
<p>Note, that we changed the output of the error in <code>main()</code> from <code>Debug</code> to <code>Display</code>, so we don't see
|
||||
the error backtrace with filename and line number.</p>
|
||||
<p>To enable the <code>Display</code> backtrace, you have to enable the feature <code>display-cause</code> for <code>chainerror</code>.</p>
|
||||
|
||||
</main>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue