Skip to content
Myr

Add Error::root_cause accessor

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent 0c21b7a · Browse files · 1 file+14 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+14 added−0 removed

  • other:+14 added−0 removed

1 file+14 added−0 removed

modified:src/error.rs+14 added
121 unmodified lines
122 next: Some(self.inner.error()),123 }124 }125126 /// The lowest level cause of this error &mdash; this error's cause's127 /// cause's cause etc.128 ///129 /// The root cause is the last error in the iterator produced by130 /// [`chain()`][Error::chain].131 pub fn root_cause(&self) -> &(dyn StdError + 'static) {132 let mut chain = self.chain();133 let mut root_cause = chain.next().unwrap();134 for cause in chain {135 root_cause = cause;136 }137 root_cause138 }139140 /// Returns `true` if `E` is the type wrapped by this error object.141 pub fn is<E>(&self) -> bool142 where143 E: Display + Debug + Send + Sync + 'static,
283 unmodified lines