make IntoResponse implementation more intuitive
msrd0 opened this issue · comments
As of right now, the IntoResponse
for Result<T, E>
just calls the IntoResponse
implementation for either type. This is fine in most use cases, but is counter-intuitive when Err("API Error")
generates a 200 response.
Reported by @tanriol on gitter.
I'd agree to this in general, but I wonder if it isn't a symptom of the "Into" happening at the wrong level. If e.g. we took a Result and produced a HandlerResult, then the Err branch there is clearly a non-success status (default to 500?).
Alternatively, IntoReponse for Errors shouldn't produce a 200, unless set explicitly.