Added macro to wrap errors
This commit is contained in:
parent
b6857ea964
commit
dfab97d9fe
@ -25,4 +25,16 @@ macro_rules! unwrap_or_return_handled_error {
|
||||
Err(error) => return actix_web_utils::traits::macro_traits::ReturnableErrorShape::convert_to_returnable::<$type_of_resp>(&error, $error_status_code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Takes whatever error you supply to it and wraps it in a GenericError<E> if err
|
||||
#[allow(unused_macros)]
|
||||
#[macro_export]
|
||||
macro_rules! wrap_generic_error_in_wrapper {
|
||||
( $e:expr ) => {
|
||||
match $e {
|
||||
Ok(value) => value,
|
||||
Err(error) => actix_web_utils::extensions::generic_error::GenericError::wrap(error),
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user