# Cohttp error cases

**URL:** <https://discuss.ocaml.org/t/cohttp-error-cases/3388>\
**Category:** Learning\
**Tags:** cohttp\
**Created:** [February 21, 2019, 8:43am UTC](https://discuss.ocaml.org/t/cohttp-error-cases/3388 "2019-02-21T08:43:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rymdhund](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@rymdhund](https://discuss.ocaml.org/u/rymdhund)\
**Post date:** [February 21, 2019, 8:43am UTC](https://discuss.ocaml.org/t/cohttp-error-cases/3388/1 "2019-02-21T08:43:22Z")

</div>

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
