retort v2.7.0 Retort.Response.Error View Source

A JSON-RPC Response Error object

Link to this section Summary

Functions

Uses rendered changset as data for error

Uses JSON API document as data for error. Only use when the document is a JSON API errors document

Converts JSON decoded map with String.t keys to t

Converts t to errors returned by Calcinator and Calcinator.Resources callbacks

Link to this section Types

Link to this type t() View Source
t() :: %Retort.Response.Error{code: integer(), data: term(), message: String.t()}

Link to this section Functions

Link to this function from_changeset(changeset) View Source
from_changeset(Ecto.Changeset.t()) :: t()

Uses rendered changset as data for error.

Link to this function from_document(document) View Source
from_document(Alembic.Document.t()) :: t()

Uses JSON API document as data for error. Only use when the document is a JSON API errors document.

Link to this function from_json(json) View Source
from_json(%{required(binary()) => integer(), required(binary()) => binary(), optional(term()) => term()}) :: t()

Converts JSON decoded map with String.t keys to t.

From error with data

iex> Retort.Response.Error.from_json(%{"code" => 0, "data" => "Data", "message" => "Zero"})
%Retort.Response.Error{code: 0, data: "Data", message: "Zero"}

From error without data

iex> Retort.Response.Error.from_json(%{"code" => 0, "message" => "Zero"})
%Retort.Response.Error{code: 0, data: nil, message: "Zero"}
Link to this function predefined(binary) View Source
predefined(String.t()) :: t()

Looks up predefined t.

Link to this function to_calcinator_error(error, changeset) View Source
to_calcinator_error(t(), maybe_changeset :: Ecto.Changeset.t() | nil) ::
  {:error, :bad_gateway} |
  {:error, :not_found} |
  {:error, :sandbox_access_disallowed} |
  {:error, Ecto.Changeset.t()}

Converts t to errors returned by Calcinator and Calcinator.Resources callbacks.