Add tower-h2 and more macro
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user