[−][src]Crate error_iter
Iterators over std::error::Error
sources on stable Rust.
use error_iter::ErrorIter; use std::io::{Error as IoError, ErrorKind}; use thiserror::Error; #[derive(Debug, Error)] enum Error { #[error("I/O Error")] Io(#[from] IoError), #[error("Unknown error")] Unknown, } impl ErrorIter for Error {} fn do_something() { let error = Error::from(IoError::new(ErrorKind::Other, "oh no!")); eprintln!("Error: {}", error); for source in error.iter_sources() { eprintln!(" Caused by: {}", source); } }
Structs
ErrorIterator |
Traits
ErrorIter | Implement this trait on your error types for free iterators over their sources! |