Skip to content

Commit f2bdfed

Browse files
committed
changed to await_next_message_body
1 parent c140781 commit f2bdfed

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,10 @@ pub fn get_capability(our: &Address, params: &str) -> Option<Capability> {
217217
.cloned()
218218
}
219219

220-
/// if the next message is a request, return its body, otherwise, return an error
221-
pub fn await_next_request_body() -> anyhow::Result<Vec<u8>> {
222-
let Ok(Message::Request { body, .. }) = await_message() else {
223-
return Err(anyhow::anyhow!("failed to get request body, bailing out"));
224-
};
225-
Ok(body)
220+
/// get the next message body from the message queue, or propagate the error
221+
pub fn await_next_message_body() -> anyhow::Result<Vec<u8>> {
222+
match await_message() {
223+
Ok(msg) => Ok(msg.body().to_vec()),
224+
Err(e) => Err(e.into()),
225+
}
226226
}

0 commit comments

Comments
 (0)