mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-02-02 23:31:41 +00:00
Merge remote-tracking branch 'origin/main' into search_combined
This commit is contained in:
commit
7e6ca820fc
1 changed files with 4 additions and 8 deletions
|
@ -242,14 +242,10 @@ cfg_if! {
|
||||||
|
|
||||||
impl actix_web::error::ResponseError for LemmyError {
|
impl actix_web::error::ResponseError for LemmyError {
|
||||||
fn status_code(&self) -> actix_web::http::StatusCode {
|
fn status_code(&self) -> actix_web::http::StatusCode {
|
||||||
if self.error_type == LemmyErrorType::IncorrectLogin {
|
match self.error_type {
|
||||||
return actix_web::http::StatusCode::UNAUTHORIZED;
|
LemmyErrorType::IncorrectLogin => actix_web::http::StatusCode::UNAUTHORIZED,
|
||||||
}
|
LemmyErrorType::NotFound => actix_web::http::StatusCode::NOT_FOUND,
|
||||||
if self.error_type == LemmyErrorType::NotFound {
|
LemmyErrorType::RateLimitError => actix_web::http::StatusCode::TOO_MANY_REQUESTS,
|
||||||
return actix_web::http::StatusCode::NOT_FOUND;
|
|
||||||
}
|
|
||||||
match self.inner.downcast_ref::<diesel::result::Error>() {
|
|
||||||
Some(diesel::result::Error::NotFound) => actix_web::http::StatusCode::NOT_FOUND,
|
|
||||||
_ => actix_web::http::StatusCode::BAD_REQUEST,
|
_ => actix_web::http::StatusCode::BAD_REQUEST,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue