actix_web_utils/extensions/
generic_error.rs

1use std::fmt::Display;
2
3/// This is a wrapper for all errors. The error must implement display at least.
4/// Usage:
5/// ```
6/// use actix_web_utils::enums::error::Error;
7/// use actix_web_utils::extensions::generic_error::GenericError;
8/// let generic_error = GenericError::wrap(Error::Unspecified);
9/// //Use it as you please
10/// ```
11pub struct GenericError<E: Display> {
12    pub error: E
13}
14impl<E: Display> GenericError<E> {
15    pub fn wrap(e: E) -> GenericError<E>{
16        GenericError { error: e }
17    }
18}