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