Skip to content

Commit

Permalink
feat(rpc): more informative parse errors
Browse files Browse the repository at this point in the history
Signed-off-by: ljedrz <[email protected]>
  • Loading branch information
ljedrz committed Jun 18, 2021
1 parent 561e1f5 commit 39d84b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rpc/src/custom_rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async fn handle_rpc<S: Storage + Send + Sync + 'static>(
_ => {
let resp = jrt::Response::<(), ()>::error(
jrt::Version::V2,
jrt::Error::from_code(jrt::ErrorCode::ParseError),
jrt::Error::with_custom_msg(jrt::ErrorCode::ParseError, "Couldn't read the RPC body"),
None,
);
let body = serde_json::to_vec(&resp).unwrap_or_default();
Expand All @@ -120,7 +120,7 @@ async fn handle_rpc<S: Storage + Send + Sync + 'static>(
Err(_) => {
let resp = jrt::Response::<(), ()>::error(
jrt::Version::V2,
jrt::Error::from_code(jrt::ErrorCode::ParseError),
jrt::Error::with_custom_msg(jrt::ErrorCode::ParseError, "Couldn't parse the RPC body"),
None,
);
let body = serde_json::to_vec(&resp).unwrap_or_default();
Expand Down

0 comments on commit 39d84b2

Please sign in to comment.