Merge branch 'add-infallible-for-ResponseError' of https://github.com/instrumentisto/actix-web into add-infallible-for-ResponseError

This commit is contained in:
nWacky 2019-09-16 16:47:00 +03:00
commit ad9ad9c6f2
1 changed files with 8 additions and 0 deletions

View File

@ -166,6 +166,14 @@ impl<E: ResponseError> ResponseError for TimeoutError<E> {
}
}
/// Return `INTERNAL_SERVER_ERROR` for `std::convert::Infallible`
impl ResponseError for std::convert::Infallible {
fn error_response(&self) -> Response {
// `std::convert::Infallible` should never happen
unreachable!()
}
}
#[derive(Debug, Display)]
#[display(fmt = "UnknownError")]
struct UnitError;