# The root cause of all Errors `chainerror` also has some helper methods: ~~~rust,ignore fn is_chain(&self) -> bool fn downcast_chain_ref(&self) -> Option<&ChainError> fn downcast_chain_mut(&mut self) -> Option<&mut ChainError> fn root_cause(&self) -> Option<&(dyn Error + 'static)> fn find_cause(&self) -> Option<&U> fn find_chain_cause(&self) -> Option<&ChainError> fn kind<'a>(&'a self) -> &'a T ~~~ Using `downcast_chain_ref::()` gives a `ChainError`, which can be used to call `.find_cause::()`. ~~~rust,ignore if let Some(s) = e.downcast_chain_ref::() { if let Some(ioerror) = s.find_cause::() { ~~~ or to use `.root_cause()`, which of course can be of any type implementing `std::error::Error`. ~~~rust,ignore if let Some(e) = s.root_cause() { ~~~ ~~~rust {{#include ../examples/tutorial7.rs}} # #[allow(dead_code)] # mod chainerror { {{#rustdoc_include ../src/lib.rs:-1}} # } ~~~