diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-05-25 22:00:19 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-05-25 22:00:19 -0400 |
commit | f41f8243a78aa40e737053d560060ad94a1c7b5c (patch) | |
tree | c8f16e102eaa872efaac2a75dba058da439ca507 /src/bin/rbw-agent/agent.rs | |
parent | fe23507043d5d476e382d364270fcc9419475958 (diff) | |
download | rbw-f41f8243a78aa40e737053d560060ad94a1c7b5c.tar.gz rbw-f41f8243a78aa40e737053d560060ad94a1c7b5c.zip |
remove more unnecessary error contexts
Diffstat (limited to 'src/bin/rbw-agent/agent.rs')
-rw-r--r-- | src/bin/rbw-agent/agent.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/bin/rbw-agent/agent.rs b/src/bin/rbw-agent/agent.rs index 655c3dc..2d9b08e 100644 --- a/src/bin/rbw-agent/agent.rs +++ b/src/bin/rbw-agent/agent.rs @@ -48,8 +48,7 @@ pub struct Agent { impl Agent { pub fn new() -> anyhow::Result<Self> { - let config = - rbw::config::Config::load().context("failed to load config")?; + let config = rbw::config::Config::load()?; let timeout_duration = tokio::time::Duration::from_secs(config.lock_timeout); let (w, r) = tokio::sync::mpsc::unbounded_channel(); @@ -125,16 +124,11 @@ async fn handle_request( sock: &mut crate::sock::Sock, state: std::sync::Arc<tokio::sync::RwLock<State>>, ) -> anyhow::Result<()> { - let req = sock - .recv() - .await - .context("failed to receive incoming message")?; + let req = sock.recv().await?; let req = match req { Ok(msg) => msg, Err(error) => { - sock.send(&rbw::protocol::Response::Error { error }) - .await - .context("failed to send response")?; + sock.send(&rbw::protocol::Response::Error { error }).await?; return Ok(()); } }; |