Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle ResponseContent is not JSON #164

Open
ptpaterson opened this issue Aug 3, 2021 · 0 comments
Open

Handle ResponseContent is not JSON #164

ptpaterson opened this issue Aug 3, 2021 · 0 comments

Comments

@ptpaterson
Copy link

If a non 2XX error code is received, then resultRequest.ResponseContent is deserialized by Newtonsoft.Json.

var wrapper = JsonConvert.DeserializeObject<ErrorsWrapper>(resultRequest.ResponseContent);

However, the ResponseContent received is sometimes not JSON. One user received the following error; it's possible that the ResponseContent is html rather than a JSON string.

Error :Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

It may be helpful to handle this error more gracefully and provide the user with a better message.

parkhomenko pushed a commit that referenced this issue Oct 22, 2021
DRV-271: Add type conversion functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant