refactor: changed error display
This commit is contained in:
parent
da4fba9203
commit
6ecaf3d908
|
@ -46,7 +46,6 @@ impl Api {
|
|||
|
||||
match response.status() {
|
||||
StatusCode::OK => (),
|
||||
StatusCode::BAD_REQUEST => return Ok(Err(Error::msg("400 - Bad Request"))),
|
||||
StatusCode::UNAUTHORIZED => return Ok(Err(Error::msg("Wrong password!"))),
|
||||
StatusCode::FORBIDDEN => {
|
||||
return Ok(Err(Error::msg("Blocked for security reasons!")))
|
||||
|
@ -57,7 +56,7 @@ impl Api {
|
|||
}
|
||||
_ => {
|
||||
return Ok(Err(Error::msg(format!(
|
||||
"Unknown error: {}",
|
||||
"Error: {}",
|
||||
response.status().to_string()
|
||||
))))
|
||||
}
|
||||
|
@ -82,14 +81,13 @@ impl Api {
|
|||
|
||||
match response.status() {
|
||||
StatusCode::OK => (),
|
||||
StatusCode::BAD_REQUEST => return Ok(Err(Error::msg("400 - Bad Request"))),
|
||||
StatusCode::UNAUTHORIZED => return Ok(Err(Error::msg("Invalid token!"))),
|
||||
StatusCode::FORBIDDEN => {
|
||||
return Ok(Err(Error::msg("Blocked for security reasons!")))
|
||||
}
|
||||
_ => {
|
||||
return Ok(Err(Error::msg(format!(
|
||||
"Unknown error: {}",
|
||||
"Error: {}",
|
||||
response.status().to_string()
|
||||
))))
|
||||
}
|
||||
|
@ -110,14 +108,13 @@ impl Api {
|
|||
|
||||
match response.status() {
|
||||
StatusCode::OK => (),
|
||||
StatusCode::BAD_REQUEST => return Ok(Err(Error::msg("400 - Bad Request"))),
|
||||
StatusCode::FORBIDDEN => {
|
||||
return Ok(Err(Error::msg("Blocked for security reasons!")))
|
||||
}
|
||||
StatusCode::NOT_FOUND => return Ok(Err(Error::msg("User not found"))),
|
||||
_ => {
|
||||
return Ok(Err(Error::msg(format!(
|
||||
"Unknown error: {}",
|
||||
"Error: {}",
|
||||
response.status().to_string()
|
||||
))))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue