aboutsummaryrefslogtreecommitdiff
path: root/src/errors.rs
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-07-20 10:31:01 -0400
committerCara Salter <cara@devcara.com>2022-07-20 10:31:01 -0400
commit4b616447715b8129ae322341959e1c2bfabbd10e (patch)
tree01c23c8a5e29d2821cdd1047d0ec27a69f8b1138 /src/errors.rs
parentb98646d8501689072f5624483d258adcbf6fc5c5 (diff)
downloadnccd-4b616447715b8129ae322341959e1c2bfabbd10e.tar.gz
nccd-4b616447715b8129ae322341959e1c2bfabbd10e.zip
emails
also subnet storage
Diffstat (limited to 'src/errors.rs')
-rw-r--r--src/errors.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/errors.rs b/src/errors.rs
index 23ad8fa..dcc0ae8 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -19,6 +19,10 @@ pub enum ServiceError {
Sql(#[from] sqlx::Error),
#[error("Bcrypt: {0}")]
Bcrypt(#[from] bcrypt::BcryptError),
+ #[error("Parse Error: {0}")]
+ Parse(String),
+ #[error("Email: {0}")]
+ Email(String),
}
pub type StringResult<T = String> = Result<T, ServiceError>;
@@ -37,3 +41,9 @@ impl IntoResponse for ServiceError {
Response::builder().status(status).body(body).unwrap()
}
}
+
+impl From<ipnetwork::IpNetworkError> for ServiceError {
+ fn from(e: ipnetwork::IpNetworkError) -> Self {
+ Self::Parse(e.to_string())
+ }
+}