diff --git a/async-nats/src/lib.rs b/async-nats/src/lib.rs index 9556bd6b9..9298523e9 100644 --- a/async-nats/src/lib.rs +++ b/async-nats/src/lib.rs @@ -516,8 +516,9 @@ impl ConnectionHandler { length, }; - // TODO don't unwrap - sender.send(message).unwrap(); + sender.send(message).map_err(|err| { + io::Error::new(io::ErrorKind::Other, "request receiver closed") + })?; } } } @@ -634,8 +635,9 @@ impl ConnectionHandler { headers, sender, } => { - // FIXME unwrap or err - let (prefix, token) = respond.rsplit_once('.').unwrap(); + let (prefix, token) = respond.rsplit_once('.').ok_or_else(|| { + io::Error::new(io::ErrorKind::Other, "malformed request subject") + })?; let multiplexer = if let Some(multiplexer) = self.multiplexer.as_mut() { multiplexer