@@ -132,13 +132,24 @@ impl Error {
132132 self . as_fail ( ) . find_root_cause ( )
133133 }
134134
135- /// Returns a iterator over the causes of the `Error`, beginning with
136- /// the failure returned by the `as_fail` method and ending with the failure
137- /// returned by `find_root_cause`.
135+ /// Returns a iterator over the causes of this error with the cause
136+ /// of the fail as the first item and the `root_cause` as the final item.
137+ ///
138+ /// Use `iter_chain` to also include the fail of this error itself.
138139 pub fn iter_causes ( & self ) -> Causes {
139140 self . as_fail ( ) . iter_causes ( )
140141 }
141142
143+ /// Returns a iterator over all fails up the chain from the current
144+ /// as the first item up to the `root_cause` as the final item.
145+ ///
146+ /// This means that the chain also includes the fail itself which
147+ /// means that it does *not* start with `cause`. To skip the outermost
148+ /// fail use `iter_causes` instead.
149+ pub fn iter_chain ( & self ) -> Causes {
150+ self . as_fail ( ) . iter_chain ( )
151+ }
152+
142153 /// Attempts to downcast this `Error` to a particular `Fail` type by
143154 /// reference.
144155 ///
@@ -162,7 +173,7 @@ impl Error {
162173 }
163174
164175 /// Deprecated alias to `iter_causes`.
165- #[ deprecated( since = "0.1.2" , note = "please use the 'iter_causes ()' method instead" ) ]
176+ #[ deprecated( since = "0.1.2" , note = "please use the 'iter_chain ()' method instead" ) ]
166177 pub fn causes ( & self ) -> Causes {
167178 Causes { fail : Some ( self . as_fail ( ) ) }
168179 }
0 commit comments