Ephemeris.Error exception (Ephemeris v0.1.0)

Copy Markdown View Source

The stable, typed failures Ephemeris returns.

Every failure carries a machine-readable :code, a fixed human-readable :message, and :details describing the specific occurrence. Match on the code; the message is for people.

Summary

Types

t()

An error owned by Ephemeris.

Functions

Returns every code this module defines.

Builds the :conflicting_parts error: Rule parts contradict each other.

Builds the :invalid_expression error: Recurrence expression is malformed.

Builds the :invalid_frequency error: Recurrence frequency is not one of the supported values.

Builds the :invalid_part error: Rule part has an invalid value.

Builds the :missing_frequency error: Recurrence rule has no frequency.

Builds the :no_occurrence error: Rule has no occurrence after the given reference.

Builds the :unknown_part error: Rule part is not recognised.

Builds the :unsupported_expression error: Expression is not one this parser understands.

Types

t()

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

An error owned by Ephemeris.

Functions

codes()

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

Returns every code this module defines.

conflicting_parts(details \\ %{})

@spec conflicting_parts(term()) :: t()

Builds the :conflicting_parts error: Rule parts contradict each other.

invalid_expression(details \\ %{})

@spec invalid_expression(term()) :: t()

Builds the :invalid_expression error: Recurrence expression is malformed.

invalid_frequency(details \\ %{})

@spec invalid_frequency(term()) :: t()

Builds the :invalid_frequency error: Recurrence frequency is not one of the supported values.

invalid_part(details \\ %{})

@spec invalid_part(term()) :: t()

Builds the :invalid_part error: Rule part has an invalid value.

missing_frequency(details \\ %{})

@spec missing_frequency(term()) :: t()

Builds the :missing_frequency error: Recurrence rule has no frequency.

no_occurrence(details \\ %{})

@spec no_occurrence(term()) :: t()

Builds the :no_occurrence error: Rule has no occurrence after the given reference.

unknown_part(details \\ %{})

@spec unknown_part(term()) :: t()

Builds the :unknown_part error: Rule part is not recognised.

unsupported_expression(details \\ %{})

@spec unsupported_expression(term()) :: t()

Builds the :unsupported_expression error: Expression is not one this parser understands.