generated from ElnuDev/rust-project
Switch 503 Service Unavailable for 500 Internal Server Error
This commit is contained in:
parent
331854b62b
commit
0f3d944ca5
1 changed files with 3 additions and 2 deletions
|
@ -25,8 +25,9 @@ impl ResponseError for Error {
|
||||||
use reqwest::StatusCode;
|
use reqwest::StatusCode;
|
||||||
use Error::*;
|
use Error::*;
|
||||||
match self {
|
match self {
|
||||||
// 503 Service Unavailable
|
// Theoretically could be 503 Service Unavailable in case remote is actually down,
|
||||||
Reqwest(error) => error.status().unwrap_or(StatusCode::SERVICE_UNAVAILABLE),
|
// but will also throw for network errors, so a generic 500 Internal Server Error is more appropriate.
|
||||||
|
Reqwest(error) => error.status().unwrap_or(StatusCode::INTERNAL_SERVER_ERROR),
|
||||||
// 403 Forbidden
|
// 403 Forbidden
|
||||||
#[cfg(feature = "nothuman")]
|
#[cfg(feature = "nothuman")]
|
||||||
NotHuman { .. } => StatusCode::FORBIDDEN,
|
NotHuman { .. } => StatusCode::FORBIDDEN,
|
||||||
|
|
Loading…
Add table
Reference in a new issue