ExPlain.Error (ExPlain v0.3.0)

Copy Markdown View Source

Represents an error returned by the Plain API or during client execution.

The :type field indicates the error category:

  • :mutation_error — a Plain API mutation returned an application-level error. Check :code, :message, and :fields for details.
  • :forbidden — authentication or authorization failed.
  • :bad_request — the request was malformed.
  • :internal_server_error — the Plain API returned a 500.
  • :graphql_error — the response contained a GraphQL error outside a mutation.
  • :unknown — an unexpected client-side error occurred.

Summary

Types

error_type()

@type error_type() ::
  :mutation_error
  | :forbidden
  | :bad_request
  | :internal_server_error
  | :graphql_error
  | :unknown

field_error()

@type field_error() :: %{
  field: String.t(),
  message: String.t(),
  type: :not_found | :required | :validation
}

t()

@type t() :: %ExPlain.Error{
  code: String.t() | nil,
  fields: [field_error()] | nil,
  message: String.t(),
  type: error_type()
}