Browse Source
Clean up errors handling in maker's HTTP response
Populate details about the problem if they're available.
fix/sql-oddness
Mariusz Klochowicz
3 years ago
No known key found for this signature in database
GPG Key ID: 470C865699C8D4D
1 changed files with
7 additions and
6 deletions
-
daemon/src/routes_maker.rs
|
|
@ -122,11 +122,11 @@ pub async fn post_sell_order( |
|
|
|
max_quantity: order.max_quantity, |
|
|
|
}) |
|
|
|
.await |
|
|
|
.unwrap_or_else(|_| anyhow::bail!("actor disconnected")) // TODO: is there a better way?
|
|
|
|
.map_err(|_| { |
|
|
|
.unwrap_or_else(|e| anyhow::bail!(e)) |
|
|
|
.map_err(|e| { |
|
|
|
HttpApiProblem::new(StatusCode::INTERNAL_SERVER_ERROR) |
|
|
|
.title("Action failed") |
|
|
|
.detail("failed to post a sell order") |
|
|
|
.title("Posting offer failed") |
|
|
|
.detail(e.to_string()) |
|
|
|
})?; |
|
|
|
|
|
|
|
Ok(status::Accepted(None)) |
|
|
@ -179,10 +179,11 @@ pub async fn post_cfd_action( |
|
|
|
|
|
|
|
result |
|
|
|
.await |
|
|
|
.unwrap_or_else(|_| anyhow::bail!("actor disconnected")) // TODO: is there a better way?
|
|
|
|
.map_err(|_| { |
|
|
|
.unwrap_or_else(|e| anyhow::bail!(e)) |
|
|
|
.map_err(|e| { |
|
|
|
HttpApiProblem::new(StatusCode::INTERNAL_SERVER_ERROR) |
|
|
|
.title(action.to_string() + " failed") |
|
|
|
.detail(e.to_string()) |
|
|
|
})?; |
|
|
|
|
|
|
|
Ok(status::Accepted(None)) |
|
|
|