mirror of
https://github.com/haraldh/chainerror.git
synced 2025-01-31 00:56:41 +01:00
parent
0fb03407c8
commit
4dfb67bc45
6
end.html
6
end.html
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html" class="active">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html" class="active">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
@ -151,7 +151,7 @@ the <a href="https://github.com/haraldh/chainerror">Git Repo</a>.</p>
|
|||
<nav class="nav-wrapper" aria-label="Page navigation">
|
||||
<!-- Mobile navigation buttons -->
|
||||
|
||||
<a rel="prev" href="tutorial12.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
||||
<a rel="prev" href="tutorial13.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
@ -165,7 +165,7 @@ the <a href="https://github.com/haraldh/chainerror">Git Repo</a>.</p>
|
|||
|
||||
<nav class="nav-wide-wrapper" aria-label="Page navigation">
|
||||
|
||||
<a href="tutorial12.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
||||
<a href="tutorial13.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
|
1306
print.html
1306
print.html
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html" class="active"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html" class="active"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html" class="active"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html" class="active"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
@ -151,7 +151,7 @@ use <code>ChainResult<(), Func1ErrorKind></code>.</p>
|
|||
<p>In <code>main</code> we can now directly use the methods of <code>ChainError<T></code> without downcasting the error first.</p>
|
||||
<p>Also a nice <code>match</code> on <code>ChainError<T>.kind()</code> is now possible, which returns <code>&T</code>, meaning
|
||||
<code>&Func1ErrorKind</code> here.</p>
|
||||
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
|
||||
<pre><pre class="playpen"><code class="language-rust">use chainerror::*;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::result::Result;
|
||||
|
@ -209,6 +209,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
# #[allow(dead_code)]
|
||||
# mod chainerror {
|
||||
# //! `chainerror` provides an error backtrace without doing a real backtrace, so even after you `strip` your
|
||||
|
@ -897,15 +898,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# ( None, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!(None, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:ident, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:path, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
|
@ -1000,21 +995,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! mstrerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
@ -1067,21 +1053,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! strerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html" class="active"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html" class="active"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
@ -156,7 +156,7 @@ src/main.rs:40: func1 error calling func2
|
|||
<p>To create your own Errors, you might find <a href="https://crates.io">crates</a> which create enum <code>Display+Debug</code> via derive macros.</p>
|
||||
<p>Also noteworthy is <a href="https://crates.io/crates/custom_error">custom_error</a> to define your custom errors,
|
||||
which can then be used with <code>chainerror</code>.</p>
|
||||
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
|
||||
<pre><pre class="playpen"><code class="language-rust">use chainerror::*;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::result::Result;
|
||||
|
@ -220,6 +220,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
# #[allow(dead_code)]
|
||||
# mod chainerror {
|
||||
# //! `chainerror` provides an error backtrace without doing a real backtrace, so even after you `strip` your
|
||||
|
@ -908,15 +909,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# ( None, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!(None, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:ident, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:path, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
|
@ -1011,21 +1006,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! mstrerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
@ -1078,21 +1064,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! strerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html" class="active"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html" class="active"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
@ -143,7 +143,7 @@
|
|||
<a class="header" href="#deref-for-the-errorkind" id="deref-for-the-errorkind"><h1>Deref for the ErrorKind</h1></a>
|
||||
<p>Because ChainError<T> implements Deref to &T, we can also match on <code>*e</code> instead of <code>e.kind()</code>
|
||||
or call a function with <code>&e</code></p>
|
||||
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
|
||||
<pre><pre class="playpen"><code class="language-rust">use chainerror::*;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::result::Result;
|
||||
|
@ -218,6 +218,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
# #[allow(dead_code)]
|
||||
# mod chainerror {
|
||||
# //! `chainerror` provides an error backtrace without doing a real backtrace, so even after you `strip` your
|
||||
|
@ -906,15 +907,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# ( None, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!(None, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:ident, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:path, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
|
@ -1009,21 +1004,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! mstrerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
@ -1076,21 +1062,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! strerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
@ -1179,7 +1156,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||
|
||||
|
||||
|
||||
<a rel="next" href="end.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||||
<a rel="next" href="tutorial13.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
@ -1197,7 +1174,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||
|
||||
|
||||
|
||||
<a href="end.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||||
<a href="tutorial13.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
|
1210
tutorial13.html
Normal file
1210
tutorial13.html
Normal file
File diff suppressed because it is too large
Load diff
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html" class="active"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html" class="active"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
@ -144,7 +144,7 @@
|
|||
<p>With relatively small changes and the help of the <code>cherr!</code> macro of the <code>chainerror</code> crate
|
||||
the <code>String</code> errors are now chained together.</p>
|
||||
<p>Press the play button in the upper right corner and see the nice debug output.</p>
|
||||
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
|
||||
<pre><pre class="playpen"><code class="language-rust">use chainerror::*;
|
||||
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
|
@ -172,6 +172,7 @@ fn func1() -> Result<(), Box<Error>> {
|
|||
fn main() -> Result<(), Box<Error>> {
|
||||
func1()
|
||||
}
|
||||
|
||||
# #[allow(dead_code)]
|
||||
# mod chainerror {
|
||||
# //! `chainerror` provides an error backtrace without doing a real backtrace, so even after you `strip` your
|
||||
|
@ -860,15 +861,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# ( None, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!(None, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:ident, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:path, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
|
@ -963,21 +958,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! mstrerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
@ -1030,21 +1016,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! strerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html" class="active"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html" class="active"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
@ -142,7 +142,7 @@
|
|||
<main>
|
||||
<a class="header" href="#mapping-errors" id="mapping-errors"><h1>Mapping Errors</h1></a>
|
||||
<p>Now let's get more rust idiomatic by using <code>.map_err()</code>.</p>
|
||||
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
|
||||
<pre><pre class="playpen"><code class="language-rust">use chainerror::*;
|
||||
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
|
@ -169,6 +169,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
# #[allow(dead_code)]
|
||||
# mod chainerror {
|
||||
# //! `chainerror` provides an error backtrace without doing a real backtrace, so even after you `strip` your
|
||||
|
@ -857,15 +858,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# ( None, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!(None, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:ident, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:path, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
|
@ -960,21 +955,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! mstrerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
@ -1027,21 +1013,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! strerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html" class="active"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html" class="active"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
@ -146,7 +146,7 @@ let you jump through hoops, <code>chainerror</code> has a quick macro for that.<
|
|||
<p><code>mstrerror!()</code> fits right into <code>.map_err()</code> letting you quickly add
|
||||
more debug strings.</p>
|
||||
<p><code>mstrerror!()</code> even understands <code>format!()</code> syntax like <code>println!()</code>.</p>
|
||||
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
|
||||
<pre><pre class="playpen"><code class="language-rust">use chainerror::*;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::result::Result;
|
||||
|
@ -173,6 +173,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
# #[allow(dead_code)]
|
||||
# mod chainerror {
|
||||
# //! `chainerror` provides an error backtrace without doing a real backtrace, so even after you `strip` your
|
||||
|
@ -861,15 +862,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# ( None, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!(None, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:ident, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:path, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
|
@ -964,21 +959,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! mstrerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
@ -1031,21 +1017,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! strerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html" class="active"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html" class="active"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
@ -143,7 +143,7 @@
|
|||
<a class="header" href="#the-source-of-errors" id="the-source-of-errors"><h1>The source() of Errors</h1></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::*;
|
||||
<pre><pre class="playpen"><code class="language-rust">use chainerror::*;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::result::Result;
|
||||
|
@ -175,6 +175,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
# #[allow(dead_code)]
|
||||
# mod chainerror {
|
||||
# //! `chainerror` provides an error backtrace without doing a real backtrace, so even after you `strip` your
|
||||
|
@ -863,15 +864,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# ( None, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!(None, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:ident, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:path, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
|
@ -966,21 +961,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! mstrerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
@ -1033,21 +1019,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! strerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html" class="active"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html" class="active"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
@ -147,7 +147,7 @@
|
|||
pub fn downcast_mut<T: Error + 'static>(&mut self) -> Option<&mut T>
|
||||
</code></pre>
|
||||
<p>This is how it looks like, when using those:</p>
|
||||
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
|
||||
<pre><pre class="playpen"><code class="language-rust">use chainerror::*;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::result::Result;
|
||||
|
@ -187,6 +187,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
# #[allow(dead_code)]
|
||||
# mod chainerror {
|
||||
# //! `chainerror` provides an error backtrace without doing a real backtrace, so even after you `strip` your
|
||||
|
@ -875,15 +876,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# ( None, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!(None, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:ident, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:path, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
|
@ -978,21 +973,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! mstrerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
@ -1045,21 +1031,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! strerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html" class="active"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html" class="active"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
@ -158,7 +158,7 @@ to call <code>.find_cause::<io::Error>()</code>.</p>
|
|||
<p>or to use <code>.root_cause()</code>, which of course can be of any type implementing <code>std::error::Error</code>.</p>
|
||||
<pre><code class="language-rust ignore"> if let Some(e) = s.root_cause() {
|
||||
</code></pre>
|
||||
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
|
||||
<pre><pre class="playpen"><code class="language-rust">use chainerror::*;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::result::Result;
|
||||
|
@ -199,6 +199,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
# #[allow(dead_code)]
|
||||
# mod chainerror {
|
||||
# //! `chainerror` provides an error backtrace without doing a real backtrace, so even after you `strip` your
|
||||
|
@ -887,15 +888,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# ( None, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!(None, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:ident, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:path, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
|
@ -990,21 +985,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! mstrerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
@ -1057,21 +1043,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! strerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html" class="active"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html" class="active"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
@ -155,7 +155,7 @@ derive_str_cherr!(Func1Error);
|
|||
<pre><code class="language-rust ignore"> if let Some(f2err) = f1err.find_cause::<ChainError<Func2Error>>() {
|
||||
</code></pre>
|
||||
<p>hiding the <code>ChainError<T></code> implementation detail.</p>
|
||||
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
|
||||
<pre><pre class="playpen"><code class="language-rust">use chainerror::*;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::result::Result;
|
||||
|
@ -196,6 +196,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
# #[allow(dead_code)]
|
||||
# mod chainerror {
|
||||
# //! `chainerror` provides an error backtrace without doing a real backtrace, so even after you `strip` your
|
||||
|
@ -884,15 +885,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# ( None, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!(None, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:ident, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:path, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
|
@ -987,21 +982,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! mstrerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
@ -1054,21 +1040,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! strerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</script>
|
||||
|
||||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html" class="active"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
<ol class="chapter"><li class="affix"><a href="index.html">chainerror</a></li><li><a href="tutorial1.html"><strong aria-hidden="true">1.</strong> Simple String Errors</a></li><li><a href="tutorial2.html"><strong aria-hidden="true">2.</strong> Simple Chained String Errors</a></li><li><a href="tutorial3.html"><strong aria-hidden="true">3.</strong> Mapping Errors</a></li><li><a href="tutorial4.html"><strong aria-hidden="true">4.</strong> Saving coding chars</a></li><li><a href="tutorial5.html"><strong aria-hidden="true">5.</strong> The source() of Errors</a></li><li><a href="tutorial6.html"><strong aria-hidden="true">6.</strong> Downcast the Errors</a></li><li><a href="tutorial7.html"><strong aria-hidden="true">7.</strong> The root cause of all Errors</a></li><li><a href="tutorial8.html"><strong aria-hidden="true">8.</strong> Finding an Error cause</a></li><li><a href="tutorial9.html" class="active"><strong aria-hidden="true">9.</strong> Selective Error Handling</a></li><li><a href="tutorial10.html"><strong aria-hidden="true">10.</strong> ErrorKind to the rescue</a></li><li><a href="tutorial11.html"><strong aria-hidden="true">11.</strong> Debug for the ErrorKind</a></li><li><a href="tutorial12.html"><strong aria-hidden="true">12.</strong> Deref for the ErrorKind</a></li><li><a href="tutorial13.html"><strong aria-hidden="true">13.</strong> Writing a library</a></li><li class="affix"><a href="end.html">The End</a></li></ol>
|
||||
</nav>
|
||||
|
||||
<div id="page-wrapper" class="page-wrapper">
|
||||
|
@ -159,7 +159,7 @@
|
|||
</code></pre>
|
||||
<p>but this is not valid rust code, so we end up doing it the hard way.
|
||||
In the next chapter, we will see, how to solve this more elegantly.</p>
|
||||
<pre><pre class="playpen"><code class="language-rust">use crate::chainerror::*;
|
||||
<pre><pre class="playpen"><code class="language-rust">use chainerror::*;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::result::Result;
|
||||
|
@ -199,6 +199,7 @@ fn main() -> Result<(), Box<Error>> {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
# #[allow(dead_code)]
|
||||
# mod chainerror {
|
||||
# //! `chainerror` provides an error backtrace without doing a real backtrace, so even after you `strip` your
|
||||
|
@ -887,15 +888,9 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# ( None, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!(None, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:ident, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:path, $k:expr ) => ({
|
||||
# ChainError::<_>::new($k, Some(Box::from($e)), Some((line!(), file!())))
|
||||
# });
|
||||
# ( $e:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
# ( $e:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($e, format!($fmt, $($arg)+ ))
|
||||
# });
|
||||
|
@ -990,21 +985,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! mstrerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# |e| cherr!(e, $t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# |e| cherr!(e, $t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
@ -1057,21 +1043,12 @@ fn main() -> Result<(), Box<Error>> {
|
|||
# /// ~~~
|
||||
# #[macro_export]
|
||||
# macro_rules! strerr {
|
||||
# ( $t:ident, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:path, $msg:expr, ) => ({
|
||||
# cherr!($t ($msg.to_string()))
|
||||
# });
|
||||
# ( $t:ident, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
# ( $t:path, $fmt:expr, $($arg:tt)+ ) => ({
|
||||
# cherr!($t (format!($fmt, $($arg)+ )))
|
||||
# });
|
||||
|
|
Loading…
Reference in a new issue