One use-case I come across recently in favor of standardized HTTP errors: HTTP caching. When the origin is unreachable (cache is disconnected), then it is allowed to serve stale content even if there is not explicit directive allowing it (max-stale cache control directive for instance).
I’ve tested with a few libraries, the situation when the host is unreachable is the following:
:httpc:{:error, :econnrefused}- Gun and Hackney:
{:error, :timeout}(this one is pretty terrible, as:timeoutcould be the server taking too long to respond) - Ibrowse:
{:error, :nxdomain} - Mint & Finch:
{:error, %Mint.TransportError{}}
IMO that’s an argument in favor of keeping errors in sync at the HTTP library level, because otherwise this has to be done by the user, which has even less knowledge about HTTP adapters.






















