summaryrefslogtreecommitdiff
path: root/src/errors.rs
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-07-10 11:05:51 -0400
committerCara Salter <cara@devcara.com>2022-07-10 11:05:51 -0400
commitd3279088e3a816db2c254b957159d5b697dc0f62 (patch)
tree764557ef69bdff984faad4885c8e00d6c9546107 /src/errors.rs
parent131dd5ab9df295b0bad320675b2307afcbf7d076 (diff)
downloadhomeworld-d3279088e3a816db2c254b957159d5b697dc0f62.tar.gz
homeworld-d3279088e3a816db2c254b957159d5b697dc0f62.zip
colonies: Fully support {meta, user}-data
cloud-init should be able to use this as a seed to properly set up the Planet.
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()));