diff options
Diffstat (limited to 'rust/src/errors.rs')
-rw-r--r-- | rust/src/errors.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/rust/src/errors.rs b/rust/src/errors.rs index 19ba2f82..ec2b949b 100644 --- a/rust/src/errors.rs +++ b/rust/src/errors.rs @@ -116,9 +116,13 @@ impl Into<models::ErrorResponse> for FatcatError { impl From<diesel::result::Error> for FatcatError { fn from(inner: diesel::result::Error) -> FatcatError { match inner { - diesel::result::Error::NotFound => FatcatError::NotFound("unknown".to_string(), "N/A".to_string()), - diesel::result::Error::DatabaseError(_, _) => FatcatError::ConstraintViolation(inner.to_string()), - _ => FatcatError::InternalError(inner.to_string()) + diesel::result::Error::NotFound => { + FatcatError::NotFound("unknown".to_string(), "N/A".to_string()) + } + diesel::result::Error::DatabaseError(_, _) => { + FatcatError::ConstraintViolation(inner.to_string()) + } + _ => FatcatError::InternalError(inner.to_string()), } } } @@ -178,4 +182,3 @@ impl From<failure::Error> for FatcatError { FatcatError::InternalError(error.to_string()) } } - |