PortableRest
PortableRest copied to clipboard
Throwing a Bad Request for all exceptions is misleading
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
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.