Add minor fixes
This commit is contained in:
parent
80d1fa32a0
commit
ee5d4e2126
6 changed files with 7 additions and 7 deletions
|
@ -10,6 +10,7 @@ pub enum ApiError {
|
|||
BadUid,
|
||||
ProtectedSchedule,
|
||||
DatabaseError(DatabaseError),
|
||||
InternalError(String),
|
||||
}
|
||||
|
||||
impl ApiError {
|
||||
|
@ -18,6 +19,7 @@ impl ApiError {
|
|||
ApiError::BadUid => StatusCode::BAD_REQUEST,
|
||||
ApiError::ProtectedSchedule => StatusCode::FORBIDDEN,
|
||||
ApiError::DatabaseError(db_error) => db_error.get_code(),
|
||||
ApiError::InternalError(_) => StatusCode::INTERNAL_SERVER_ERROR,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +42,7 @@ impl From<&ApiError> for String {
|
|||
ApiError::BadUid => String::from("the uid is in a bad format"),
|
||||
ApiError::ProtectedSchedule => String::from("the targeted schedule is protected"),
|
||||
ApiError::DatabaseError(db_err) => String::from(db_err),
|
||||
ApiError::InternalError(msg) => msg.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
extern crate dotenv;
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
use actix_web::middleware::TrailingSlash;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue