Add `Error::as_response`
k0nserv opened this issue · comments
Hugo Tunius commented
Hello,
On Error
there's currently a method called into_response
which consumes the errors and converts it into a response, if the error occurred due to semantics of the response. However, this method consumes the errors and as such makes it impossible to e.g. check the status code while retaining the error.
The suggested as_response
method would alleviate this by not consuming the error i.e.
pub fn as_response(&self) -> Option<&Response> {
todo!()
}
Let me know if you like this idea and I can send a PR.
Thanks for your consideration
Martin Algesten commented
Hi @k0nserv!
Martin Algesten commented
The Error in str0m is an enum, you can match out the status without converting. We could of course make a helper.
Hugo Tunius commented
Ah right, I'm just being a dummy 🤦♂️