Add tower-h2 and more macro

This commit is contained in:
Lucio Franco
2019-08-11 13:48:13 -04:00
parent aef683fe35
commit 404f7d8931
16 changed files with 727 additions and 33 deletions
+12
View File
@@ -0,0 +1,12 @@
pub(crate) fn reason_from_dyn_error(err: &(dyn std::error::Error + 'static)) -> h2::Reason {
let mut cause = Some(err);
while let Some(err) = cause {
if let Some(h2_err) = err.downcast_ref::<h2::Error>() {
return h2_err.reason().unwrap_or(h2::Reason::INTERNAL_ERROR);
}
cause = err.source();
}
// unknown error
h2::Reason::INTERNAL_ERROR
}