rdrive/
error.rs

1use alloc::{boxed::Box, format, string::String};
2
3#[derive(thiserror::Error, Debug)]
4pub enum DriverError {
5    #[error("FDT error: {0}")]
6    Fdt(String),
7    #[error("Unknown driver error: {0}")]
8    Unknown(String),
9}
10
11impl From<fdt_parser::FdtError<'_>> for DriverError {
12    fn from(value: fdt_parser::FdtError<'_>) -> Self {
13        Self::Fdt(format!("{value:?}"))
14    }
15}
16
17impl From<Box<dyn core::error::Error>> for DriverError {
18    fn from(value: Box<dyn core::error::Error>) -> Self {
19        Self::Unknown(format!("{value:?}"))
20    }
21}