Agenda.Infeasible exception (Agenda v0.1.0)

Copy Markdown View Source

Why a session cannot be held.

Every infeasible result carries reasons, and the struct cannot be built without them — an empty explanation is a defect, not a degraded answer. "No arrangement found" tells a user nothing they can act on; "the Boardroom qualifies but is allocated to the Board meeting all week" tells them who to ask.

Summary

Types

t()

A session that cannot be placed, and why.

Functions

The failure as a sentence.

Build an infeasible result.

Types

t()

@type t() :: %Agenda.Infeasible{
  __exception__: term(),
  reasons: [String.t(), ...],
  session: String.t()
}

A session that cannot be placed, and why.

Functions

message(infeasible)

@spec message(t()) :: String.t()

The failure as a sentence.

Arguments

  • reason is a t/0.

Returns

  • a sentence naming the session and every reason.

Examples

iex> reason = Agenda.Infeasible.new("Review", ["no room seats 8", "Alice is away"])
iex> Agenda.Infeasible.message(reason)
"Review cannot be held: no room seats 8; Alice is away"

new(session, reasons)

@spec new(String.t(), [String.t(), ...]) :: t()

Build an infeasible result.

Arguments

  • session is the session's name.

  • reasons is a non-empty list of phrases explaining the failure.

Returns

Examples

iex> reason = Agenda.Infeasible.new("Review", ["no room seats 8"])
iex> reason.reasons
["no room seats 8"]