Net Http API Client from Scratch Discussion
This is a great summary and takes some of the scare away I had regarding Net::HTTP. However one of the reasons I always went with Faraday was the error handling. Net::HTTP seems to have all kinds of different exceptions I do not really care about. Maybe you can include the error handling into one of the upcoming episodes.
Errors are definitely a bit of a pain. I liked this approach from StackOverflow: https://stackoverflow.com/questions/5370697/what-s-the-best-way-to-handle-exceptions-from-nethttp
ALL_NET_HTTP_ERRORS = [
Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError
]
begin
your_http_logic()
rescue *ALL_NET_HTTP_ERRORS
…
end
Hey Chris, are we able to access the older version of this episode?
The old episodes are still there. This is just a new series digging deeper into designing API clients. 👍
Cat is a superstar. There's something about interruptions that makes things more funny and authentic. So if this basically the first step before extracting this to a ruby gem to build an sdk/wrapper? I'm going to watch that course next.