summaryrefslogtreecommitdiff
path: root/src/errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/errors.rs')
-rw-r--r--src/errors.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/errors.rs b/src/errors.rs
index 6b3195f..e513343 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -16,6 +16,9 @@ pub enum ServiceError {
#[error("SQL error: {0}")]
Sql(#[from] sqlx::Error),
+ #[error("Generic: {0}")]
+ Generic(#[from] Box<dyn std::error::Error>),
+
#[error("Not Found")]
NotFound,
@@ -23,10 +26,14 @@ pub enum ServiceError {
NotAuthorized,
}
-pub type StringResult<T = &'static str> = Result<T, ServiceError>;
+pub type StringResult<T = String> = Result<T, ServiceError>;
+
+pub type StrResult<T= &'static str> = Result<T, ServiceError>;
pub type JsonResult<T> = Result<T, ServiceError>;
+pub type NoneResult = Result<(), ServiceError>;
+
impl IntoResponse for ServiceError {
fn into_response(self) -> Response {
let body = body::boxed(body::Full::from(self.to_string()));