diff --git a/src/lib.rs b/src/lib.rs index 3a51d1e..e89a848 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -290,6 +290,16 @@ impl ChainError { .next() } + // FIXME: naming + fn find_chain_or_cause(&self) -> Option<&U> { + self.iter() + .filter_map(|e| { + e.downcast_ref::>().map(|e| e.kind()) + .or_else(|| e.downcast_ref::()) + }) + .next() + } + /** return a reference to T of `ChainError` # Examples