Dowser.Elasticsearch.Error exception (Dowser.Elasticsearch v0.1.0)

View Source

An error response returned by Elasticsearch — a non-2xx HTTP status.

:status is the HTTP status code and :body the (decoded) response body. When the body is a standard Elasticsearch error object (%{"error" => %{"type" => ..., "reason" => ...}}), :type and :reason are extracted for convenience.

Summary

Functions

Builds an error from a response status and body, extracting :type/:reason from a standard Elasticsearch error body when present.

Types

t()

@type t() :: %Dowser.Elasticsearch.Error{
  __exception__: true,
  body: term(),
  reason: String.t() | nil,
  status: non_neg_integer(),
  type: String.t() | nil
}

Functions

new(status, body)

@spec new(non_neg_integer(), term()) :: t()

Builds an error from a response status and body, extracting :type/:reason from a standard Elasticsearch error body when present.