Closed lnicola closed 5 years ago
The web
function is already public in the master branch, and with this PR merged, we won't need web
function because From<error::error::Error>
implementation for extract:error::Error
looks as a better alternative.
Thanks, that seems nice. One question: should internal_error
be public, too? It can be emulated with the same code (Error::web(ErrorKind::internal().into())
), but might come in handy.
EDIT: well, I guess that #171 will deprecate that pattern.
@lnicola the PR will make the following possible
Error::from(StatusCode::INTERNAL_SERVER_ERROR).into()
I don't think there's a way to report server errors that occur during extraction. There is a
tower_web::extract::Error::web
function, but it's private.This would be useful when doing e.g. IO (maybe looking up a session in a database), which can fail due to reasons outside of the client's control.