ā BaseApiClient - help on handling null returns / exceptions, logging
Hello! I am pretty new here.
I've been following some real world examples I have in my life and been trying to just wrap my mind about everything and make a solid BaseApiClient class.
What I currently have is seen in the pictures.
What I currently don't like is how I get a warning message of possible null return on all DeserializeAsync.
How would you guys handle these calls?
And I am also quite new to logging. Should I log something in this class as well? (for example the response content in EnsureSuccess method)
šš¾ š»
4 Replies
Stack Overflow
Is null valid JSON (4 bytes, nothing else)
Hot debate today:
Is the text stream null valid JSON?
According to http://www.ietf.org/rfc/rfc4627.txt?number=4627:
...
2. JSON Grammar
A JSON text is a sequence of tokens. The set of
A JSON text is a sequence of tokens. The set of
null
is a valid response
return Task<Response?>
or enforce that it's not null with an exceptionyeah, I think I'll enforce it, because the API's I am using do not return nulls
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.