Module Endpoint.Error

An Error.t represents a "normal" error when making an API request.

"Normal" includes transient errors such as a loss of connectivity or HTTP responses representing temporary server issues. It also includes HTTP responses indicating an illegal operation, such as permission errors.

It does not include programming errors within Reddit_api_kernel; if we can't parse a response, we raise instead of returning an error value.

type t =
  1. | Cohttp_raised of Core.Exn.t
  2. | Json_parsing_error of {
    1. error : Core.Error.t;
    2. response : Cohttp.Response.t;
    3. body_string : string;
    }
  3. | Http_error of {
    1. response : Cohttp.Response.t;
    2. body : Cohttp.Body.t;
    }
    (*

    An Http_error represents an HTTP response with an error status for which we have not parsed details from the JSON body.

    400 Bad Request responses come with parseable JSON details, so they are included under Json_response_errors instead.

    *)
  4. | Json_response_errors of Json_response_error.t list
val sexp_of_t : t -> Sexplib0.Sexp.t