sea_orm_codegen/
error.rs

1use std::{error, fmt, io};
2
3#[derive(Debug)]
4pub enum Error {
5    StdIoError(io::Error),
6    TransformError(String),
7}
8
9impl fmt::Display for Error {
10    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
11        match self {
12            Self::StdIoError(e) => write!(f, "{e:?}"),
13            Self::TransformError(e) => write!(f, "{e:?}"),
14        }
15    }
16}
17
18impl error::Error for Error {
19    fn source(&self) -> Option<&(dyn error::Error + 'static)> {
20        match self {
21            Self::StdIoError(e) => Some(e),
22            Self::TransformError(_) => None,
23        }
24    }
25}
26
27impl From<io::Error> for Error {
28    fn from(io_err: io::Error) -> Self {
29        Self::StdIoError(io_err)
30    }
31}