Cardbox.Error exception (Cardbox v0.1.0)

Copy Markdown View Source

Why a write or a query did not happen.

reason is one of:

  • :invalid - a value, a field or a query that does not check; errors says which, as {field_key, message} (nil for the whole of it);
  • :conflict - a value someone changed meanwhile (the :expect option of an update); current is the record as it is now;
  • :not_found - a record, field or view that is not in the collection;
  • :unauthorized - the module's Cardbox.allow?/3 said no.

message says it in words, for a person or an agent.

Summary

Types

t()

@type t() :: %Cardbox.Error{
  __exception__: term(),
  current: term(),
  errors: [{String.t() | nil, String.t()}],
  message: String.t(),
  reason: :invalid | :conflict | :not_found | :unauthorized
}