1
0
Fork 0
mirror of https://git.42l.fr/neil/sncf.git synced 2024-04-28 12:12:44 +02:00

Implementing appropriate error codes for each error. Fixes #7

This commit is contained in:
neil 2020-08-22 16:33:44 +02:00
parent 1c02c142c9
commit fe3759d941

View file

@ -38,7 +38,24 @@ impl error::ResponseError for TrainCrash {
}
fn status_code(&self) -> StatusCode {
match *self {
match self.error_msg {
"error_forward_req" => StatusCode::BAD_GATEWAY,
"error_forward_resp" => StatusCode::BAD_GATEWAY,
"error_login_get" => StatusCode::BAD_GATEWAY,
"error_login_get_body" => StatusCode::BAD_GATEWAY,
"error_login_post" => StatusCode::BAD_GATEWAY,
"error_login_redir" => StatusCode::BAD_GATEWAY,
"error_createaccount_post" => StatusCode::BAD_GATEWAY,
"error_createaccount_post_body" => StatusCode::BAD_GATEWAY,
"error_createaccount_status" => StatusCode::BAD_GATEWAY,
"error_createaccount_ncstatus" => StatusCode::BAD_GATEWAY,
"error_forwardlogin_notfound" => StatusCode::NOT_FOUND,
"error_forwardregister_tokenparse" => StatusCode::BAD_REQUEST,
"error_login_cookiepair" => StatusCode::BAD_GATEWAY,
"error_login_regex" => StatusCode::BAD_GATEWAY,
"error_login_setcookie" => StatusCode::BAD_REQUEST,
"error_createaccount" => StatusCode::BAD_GATEWAY,
"error_dirtyhacker" => StatusCode::UNAUTHORIZED,
_ => StatusCode::INTERNAL_SERVER_ERROR,
}
}