package aws

  1. Overview
  2. Docs

This contains errors that are returned from AWS api calls.

type 'a code =
  1. | Understood of 'a
  2. | Unknown of string

An individual error returned from AWS.

type bad_response = {
  1. body : string;
  2. message : string;
}

Contents of a bad response error, containing the body of what could not be interpreted and a (potential) reason why.

type 'a error_response =
  1. | BadResponse of bad_response
    (*

    A BadResponse is an error response that could not be parsed into AWS error data structures.

    *)
  2. | AwsError of ('a code * string) list
    (*

    An AwsError is a list of errors parsed out of XML returned in a non-2xx response.

    *)

An error_response is returned when an HTTP response returns with a non-2xx code.

type 'a t =
  1. | TransportError of string
    (*

    TransportError indicate that an error occurred at the level of the HTTP request (and generally, nothing was returned).

    *)
  2. | HttpError of int * 'a error_response
    (*

    HttpError indicates that a response was recieved with an HTTP error code (non-2xx)

    *)
val format : ('a -> string) -> 'a t -> string

Produces a string representation of an error, suitable for printing.

val parse_aws_error : string -> [ `Ok of (string * string) list | `Error of string ]

Given a string error response, produces (code,message) pairs. If the body can't be decoded, produces an `Error reason. This is used by runtime implementations in the case they get a non-success response code.

OCaml

Innovation. Community. Security.