Periodical.Error exception (Periodical v0.2.0)

Copy Markdown View Source

Defines the stable, typed failures returned by Periodical.

Every failure carries a machine-readable :code, a fixed human-readable :message, and free-form :details describing the specific occurrence. The code is the stable part: match on it rather than on message text.

Each code has a constructor of the same name:

iex> error = Periodical.Error.overloaded(%{limit: 100})
iex> {error.code, error.details}
{:overloaded, %{limit: 100}}

Summary

Types

t()

An error owned by Periodical.

Functions

Returns every code this module defines, for exhaustiveness checks.

Builds the :dependency_unavailable error: A configured optional dependency is unavailable.

Builds the :drain_timeout error: Scheduler drain deadline expired.

Builds the :duplicate_name error: A schedule with this name already exists.

Builds the :invalid_config error: Periodical configuration is invalid.

Builds the :invalid_schedule error: Schedule definition is invalid.

Builds the :overloaded error: Schedule capacity has been reached.

Builds the :schedule_not_found error: Schedule was not found.

Builds the :shutting_down error: Scheduler is shutting down.

Types

t()

@type t() :: %Periodical.Error{
  __exception__: true,
  code: atom(),
  details: term(),
  message: String.t()
}

An error owned by Periodical.

Functions

codes()

@spec codes() :: [atom()]

Returns every code this module defines, for exhaustiveness checks.

dependency_unavailable(details \\ %{})

@spec dependency_unavailable(term()) :: t()

Builds the :dependency_unavailable error: A configured optional dependency is unavailable.

drain_timeout(details \\ %{})

@spec drain_timeout(term()) :: t()

Builds the :drain_timeout error: Scheduler drain deadline expired.

duplicate_name(details \\ %{})

@spec duplicate_name(term()) :: t()

Builds the :duplicate_name error: A schedule with this name already exists.

invalid_config(details \\ %{})

@spec invalid_config(term()) :: t()

Builds the :invalid_config error: Periodical configuration is invalid.

invalid_schedule(details \\ %{})

@spec invalid_schedule(term()) :: t()

Builds the :invalid_schedule error: Schedule definition is invalid.

overloaded(details \\ %{})

@spec overloaded(term()) :: t()

Builds the :overloaded error: Schedule capacity has been reached.

schedule_not_found(details \\ %{})

@spec schedule_not_found(term()) :: t()

Builds the :schedule_not_found error: Schedule was not found.

shutting_down(details \\ %{})

@spec shutting_down(term()) :: t()

Builds the :shutting_down error: Scheduler is shutting down.