PortableRest icon indicating copy to clipboard operation
PortableRest copied to clipboard

Throwing a Bad Request for all exceptions is misleading

Open jeffijoe opened this issue 10 years ago • 1 comments

Currently, when the Rest Client encounters an exception, it wraps it in a RestResponse with a Bad Request code.

This is misleading, especially since there are no sanity checks when adding Url segments or query strings (e.g. is the value null?). This results in exceptions that are not caused by the HTTP client itself, and so deserves to be wrapped in PortableRestException - or at least just be thrown as-is.

Offending code: https://github.com/advancedrei/PortableRest/blob/master/src/PortableRest/RestClient.cs#L193

jeffijoe avatar Apr 14 '15 16:04 jeffijoe

So I just spent the last few hours trying to figure out this exact issue. My entity changed and instead of giving me a serialization error, it gave me a bad request. I agree that this should be changed.

valdetero avatar Oct 22 '15 21:10 valdetero