DEV Community

Discussion on: Creating a Functional Wrapper in F#

Collapse
 
jhewlett profile image
Justin Hewlett

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

Collapse
 
arnondanon profile image
ArnonDanon

Thanks for finding the time to reply,
much appriciated