View Source Errata.DomainError (Errata v0.9.0)

Domain errors represent error conditions within a problem domain or bounded context.

Domain errors are business-process violations, data-consistency errors, or other errors within the problem domain. As such, a domain error should have a meaningful name within its context, and the precise meaning of that name should be part of the Ubiquitous Language of the domain.

Define a domain error by creating a module that uses Errata.DomainError. The resulting type is an Errata.Error of kind :domain: it shares the common structure of all Errata errors and supports every callback of the Errata.Error behaviour. See Errata.Error for the full set of options and callbacks.

Usage

To define a new custom domain error type, use/2 the Errata.DomainError module in your own error module:

defmodule MyApp.Orders.OrderNotFound do
  use Errata.DomainError,
    default_message: "the requested order does not exist"
end

Summary

Types

t()

Type to represent Errata domain errors.

Types

@type t() :: Errata.domain_error()

Type to represent Errata domain errors.