Skip to content

Commit

Permalink
Merge pull request #67 from kinode-dao/da/docstring
Browse files Browse the repository at this point in the history
await_next_request_body > await_next_message_body
  • Loading branch information
tadad authored Apr 2, 2024
2 parents ccf9db2 + 0a52bf7 commit ee06628
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,10 @@ pub fn get_capability(our: &Address, params: &str) -> Option<Capability> {
.cloned()
}

pub fn await_next_request_body() -> anyhow::Result<Vec<u8>> {
let Ok(Message::Request { body, .. }) = await_message() else {
return Err(anyhow::anyhow!("failed to get request body, bailing out"));
};
Ok(body)
/// get the next message body from the message queue, or propagate the error
pub fn await_next_message_body() -> Result<Vec<u8>, SendError> {
match await_message() {
Ok(msg) => Ok(msg.body().to_vec()),
Err(e) => Err(e.into()),
}
}

0 comments on commit ee06628

Please sign in to comment.