Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

Commit

Permalink
Resolve TODO
Browse files Browse the repository at this point in the history
As per RFC1, responses that fail to deserialize should simply be
logged.
  • Loading branch information
thomaseizinger committed Feb 12, 2019
1 parent f638df8 commit c6d72b6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions vendor/bam/src/json/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,22 @@ impl FrameHandler<json::Frame> for JsonFrameHandler {
.get_awaiting_response(frame.id)
.ok_or(Error::UnexpectedResponse)?;

debug!("Dispatching response frame {:?} to stored handler.", frame);
debug!(
"attempting to deserialize payload '{:?}' of frame {:?} as RESPONSE",
frame.payload, frame.id
);

let response = serde_json::from_value(frame.payload);

match response {
Ok(response) => sender.send(response).unwrap(),
// TODO: Decide what happens when response fails to deserialize
Err(e) => info!("Failed to deserialize response: {:?}", e),
Ok(response) => {
debug!("dispatching {:?} to stored handler", response);
sender.send(response).unwrap()
}
Err(e) => error!(
"payload of frame {} is not a well-formed RESPONSE: {:?}",
frame.id, e
),
}

Ok(None)
Expand Down

0 comments on commit c6d72b6

Please sign in to comment.