1#[derive(Debug, thiserror::Error)]
3pub enum Error {
4 #[error(transparent)]
6 MultipartError(multer::Error),
7
8 #[error(transparent)]
10 Other(Box<dyn std::error::Error + Send + Sync>),
11}
12
13impl Error {
14 pub fn new(error: impl Into<Box<dyn std::error::Error + Send + Sync>>) -> Self {
16 Error::Other(error.into())
17 }
18
19 pub fn from_multer(error: multer::Error) -> Self {
21 Error::MultipartError(error)
22 }
23}
24
25impl From<multer::Error> for Error {
26 fn from(error: multer::Error) -> Self {
27 Error::from_multer(error)
28 }
29}