Thanks for the reply, glad you liked it. The error handling is no different than it would be in C# here: callers would need to be prepared to handle HttpRequestException (or an AggregateException with an inner HttpRequestException due to the Task) for network errors, and TaskCanceledException if you're using timeouts.
In my own code I often catch and convert those exceptions to Results, but that's somewhat opinionated and felt beyond the scope of this post.
Also, non-200 status codes will not throw and can be handled through pattern matching
Thanks for the reply, glad you liked it. The error handling is no different than it would be in C# here: callers would need to be prepared to handle
HttpRequestException
(or anAggregateException
with an innerHttpRequestException
due to theTask
) for network errors, andTaskCanceledException
if you're using timeouts.In my own code I often catch and convert those exceptions to
Result
s, but that's somewhat opinionated and felt beyond the scope of this post.Also, non-200 status codes will not throw and can be handled through pattern matching
Thanks for finding the time to reply,
much appriciated