Quiddity.Error exception (ExQuiddity v0.1.2)

Copy Markdown View Source

A refusal from the engine, with the code a caller can branch on.

The codes are quiddity's own vocabulary, so a caller who reads its documentation is not learning a second one:

  • "unreadable" — the file is not there, or cannot be opened;
  • "broken_step" — the kernel read it and refused it (parse, unsupported, incomplete, or past a bound it keeps);
  • "bad_request" — the question was malformed: not three numbers, a camera with no direction, a face the part does not have;
  • "unresolved_geometry" — a face the ray meets has a surface the kernel cannot intersect, so the answer would be a guess;
  • "internal" — a document that could not be written.

A refusal is a value, not an exception: a tool that cannot answer still answers, and says what to try next.

Summary

Functions

A refusal, from the engine's {code, message} pair.

Types

t()

@type t() :: %Quiddity.Error{
  __exception__: term(),
  code: String.t(),
  message: String.t()
}

Functions

new(arg)

@spec new({String.t(), String.t()}) :: t()

A refusal, from the engine's {code, message} pair.