1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
//! runi error types // https://docs.rs/thiserror/latest/thiserror/ use thiserror::Error; #[derive(Debug, Error)] pub enum MyError { // Derive Into<MyError> for io errors #[error("My Io error: {0}")] Io(#[from] std::io::Error), // Derive Into<MyError> for anyhow errors #[error(transparent)] Anyhow(#[from] anyhow::Error), // Some other error type #[allow(dead_code)] #[error("an unhandled error")] Unhandled, }