Add service_error module for error handling

This commit is contained in:
GW_MC
2025-12-02 16:55:08 +08:00
parent 6cd55d06a2
commit 8b98590a1e
2 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
pub type ServiceError = Box<dyn std::error::Error + Send + Sync>;
pub trait IntoServiceError {
fn into_service_error(self) -> ServiceError;
}
impl<T> IntoServiceError for T
where
T: std::error::Error + Send + Sync + 'static,
{
fn into_service_error(self) -> ServiceError {
Box::new(self)
}
}