Refit: Content in ValidationApiException hides Content in derived ApiException

Created on 15 Mar 2019  路  4Comments  路  Source: reactiveui/refit

Hi

I think it's a bad design to hide the Content property of the derived class ApiException. The reason is that if you don't catch ValidationApiException but catch ApiException, you expect to get the Content property as string. However, if the real content is a problem+json document, it's null in the ApiException.
A better approach would be to have a new property in the ValidationApiException class that returns the ProblemDetails and keep Content as text, giving the client a chance to deserialize the problem itself.

Staffan

bug enhancement

Most helpful comment

@jamiehowarth0 See my PR!

All 4 comments

I'm having this exact issue right now. Took me 30 minutes to finally track down this issue.

It's because the request object is disposed when catching the exception. I'll look at how to do this in a better fashion.

@jamiehowarth0 See my PR!

I'm facing this exact same issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eduardocampano picture eduardocampano  路  6Comments

AnjaliSahu51 picture AnjaliSahu51  路  4Comments

Mike-E-angelo picture Mike-E-angelo  路  6Comments

tstivers1990 picture tstivers1990  路  5Comments

mary-perret-1986 picture mary-perret-1986  路  5Comments