Cohttp error cases

Hello! I’m trying out cohttp as a http client and I’m mostly using Cohttp_lwt_unix.Client.get. When my requests fail with rejected Lwt promises I get different errors depending on what went wrong, like dns errors, connection errors or tls errors. So far I’ve seen at least Failure, Tls_lwt.Tls_alert and some different Unix.Unix_error exceptions.

Is there any way to figure out what different errors to expect without resorting to reading the source code? The documentation doesn’t seem to mention the different error cases. Or should I just give up on trying to handle the distinct errors and just add a catch-all? That feels a bit crude

1 Like