refactor(http2): make several http2 errors more specific

This commit is contained in:
Sean McArthur
2018-12-11 15:59:35 -08:00
parent f8f926c14c
commit 9b69fa9740
2 changed files with 6 additions and 6 deletions

View File

@@ -123,7 +123,7 @@ where
if self.body_tx.capacity() == 0 {
loop {
match try_ready!(self.body_tx.poll_capacity().map_err(::Error::new_h2)) {
match try_ready!(self.body_tx.poll_capacity().map_err(::Error::new_body_write)) {
Some(0) => {}
Some(_) => break,
None => return Err(::Error::new_canceled(None::<::Error>)),
@@ -131,10 +131,10 @@ where
}
} else {
if let Async::Ready(reason) =
self.body_tx.poll_reset().map_err(|e| ::Error::new_h2(e))?
self.body_tx.poll_reset().map_err(::Error::new_body_write)?
{
debug!("stream received RST_STREAM: {:?}", reason);
return Err(::Error::new_h2(reason.into()));
return Err(::Error::new_body_write(::h2::Error::from(reason)));
}
}
@@ -169,10 +169,10 @@ where
}
} else {
if let Async::Ready(reason) =
self.body_tx.poll_reset().map_err(|e| ::Error::new_h2(e))?
self.body_tx.poll_reset().map_err(|e| ::Error::new_body_write(e))?
{
debug!("stream received RST_STREAM: {:?}", reason);
return Err(::Error::new_h2(reason.into()));
return Err(::Error::new_body_write(::h2::Error::from(reason)));
}
match try_ready!(self.stream.poll_trailers().map_err(|e| self.on_err(e))) {