This repository was archived by the owner on Aug 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -50,13 +50,16 @@ macro_rules! error_chain_processed {
50
50
}
51
51
52
52
) => {
53
- /// The Error type
53
+ /// The Error type.
54
54
///
55
- /// This has a simple structure to support pattern matching
56
- /// during error handling. The second field is internal state
57
- /// that is mostly irrelevant for error handling purposes.
55
+ /// This struct is made of three things:
56
+ ///
57
+ /// - an `ErrorKind` which is used to determine the type of the error.
58
+ /// - a backtrace, generated when the error is created.
59
+ /// - an error chain, used for the implementation of `Error::cause()`.
58
60
#[ derive( Debug ) ]
59
61
pub struct $error_name {
62
+ // The members must be `pub` for `links`.
60
63
/// The kind of the error.
61
64
#[ doc( hidden) ]
62
65
pub kind: $error_kind_name,
@@ -82,7 +85,7 @@ macro_rules! error_chain_processed {
82
85
83
86
#[ allow( dead_code) ]
84
87
impl $error_name {
85
- /// Constructs an error from a kind.
88
+ /// Constructs an error from a kind, and generates a backtrace .
86
89
pub fn from_kind( kind: $error_kind_name) -> $error_name {
87
90
$error_name {
88
91
kind: kind,
@@ -189,7 +192,7 @@ macro_rules! error_chain_processed {
189
192
// --------------
190
193
191
194
quick_error! {
192
- /// The kind of an error
195
+ /// The kind of an error.
193
196
#[ derive( Debug ) ]
194
197
pub enum $error_kind_name {
195
198
Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ mod error_chain;
272
272
#[ cfg( feature = "example_generated" ) ]
273
273
pub mod example_generated;
274
274
275
- /// Iterator over the error chain.
275
+ /// Iterator over the error chain using the `Error::cause()` method .
276
276
pub struct ErrorChainIter < ' a > ( pub Option < & ' a error:: Error > ) ;
277
277
278
278
impl < ' a > Iterator for ErrorChainIter < ' a > {
You can’t perform that action at this time.
0 commit comments