gotham icon indicating copy to clipboard operation
gotham copied to clipboard

make IntoResponse implementation more intuitive

Open msrd0 opened this issue 5 years ago • 1 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.

msrd0 avatar Sep 05 '20 19:09 msrd0

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.

nyarly avatar Oct 20 '20 15:10 nyarly