Skip to content

Commit

Permalink
rest: Include full RPC error messages in HTTP replies
Browse files Browse the repository at this point in the history
Using the `From<errors::Error> for HttpError` conversion, which
uses the full Error `Display` instead of just its `description().

Resolves romanz#132.
  • Loading branch information
shesek committed Dec 3, 2024
1 parent 680eaca commit d211fcc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,7 @@ fn handle_request(
.ok_or_else(|| HttpError::from("Missing tx".to_string()))?,
_ => return http_message(StatusCode::METHOD_NOT_ALLOWED, "Invalid method", 0),
};
let txid = query
.broadcast_raw(&txhex)
.map_err(|err| HttpError::from(err.description().to_string()))?;
let txid = query.broadcast_raw(&txhex)?;
http_message(StatusCode::OK, txid.to_string(), 0)
}

Expand Down

0 comments on commit d211fcc

Please sign in to comment.