diff --git a/apps/api/src/errors.rs b/apps/api/src/errors.rs new file mode 100644 index 0000000..ae13070 --- /dev/null +++ b/apps/api/src/errors.rs @@ -0,0 +1 @@ +pub mod service_error; diff --git a/apps/api/src/errors/service_error.rs b/apps/api/src/errors/service_error.rs new file mode 100644 index 0000000..ce8c3f8 --- /dev/null +++ b/apps/api/src/errors/service_error.rs @@ -0,0 +1,14 @@ +pub type ServiceError = Box; + +pub trait IntoServiceError { + fn into_service_error(self) -> ServiceError; +} + +impl IntoServiceError for T +where + T: std::error::Error + Send + Sync + 'static, +{ + fn into_service_error(self) -> ServiceError { + Box::new(self) + } +}