Schooner.Host.TypeError exception (schooner v1.0.0)

Copy Markdown View Source

Raised by Schooner.Host asserting accessors (to_*!/2) when a Scheme value does not match the shape the host expected.

The exception carries :op (a host-supplied label naming the call site, e.g. "my-lib/info"), :expected (a short description of the shape that was demanded, e.g. "string", "proper list"), and :got (the actual value, rendered with inspect/1 in the message). Tests can pattern on :op and :expected without coupling to wording.

Summary

Types

t()

@type t() :: %Schooner.Host.TypeError{
  __exception__: true,
  expected: binary(),
  got: term(),
  message: binary(),
  op: binary()
}