diff --git a/src/errors.rs b/src/errors.rs index 8c7a49e..0aa4c91 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -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, } }