Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions src/hyperapp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,16 @@ where
return Ok(r);
}

let e = serde_json::from_slice::<SendError>(&response_bytes)
.expect("Failed to deserialize response to send()");
return Err(AppSendError::SendError(e));
match serde_json::from_slice::<SendError>(&response_bytes) {
Ok(e) => Err(AppSendError::SendError(e)),
Err(err) => {
error!(
"Failed to deserialize response in send(): {} (payload: {:?})",
err, response_bytes
);
Err(AppSendError::BuildError(BuildError::NoBody))
}
}
}

pub async fn send_rmp<R>(request: Request) -> Result<R, AppSendError>
Expand All @@ -292,9 +299,16 @@ where
return Ok(r);
}

let e = rmp_serde::from_slice::<SendError>(&response_bytes)
.expect("Failed to deserialize response to send()");
return Err(AppSendError::SendError(e));
match rmp_serde::from_slice::<SendError>(&response_bytes) {
Ok(e) => Err(AppSendError::SendError(e)),
Err(err) => {
error!(
"Failed to deserialize response in send_rmp(): {} (payload: {:?})",
err, response_bytes
);
Err(AppSendError::BuildError(BuildError::NoBody))
}
}
}

// Enum defining the state persistance behaviour
Expand Down