Schooner.Error exception (schooner v1.1.0)

Copy Markdown View Source

Host-side exception raised when a Scheme raise / raise-continuable / error is not caught by any installed with-exception-handler or guard. The struct carries the original Scheme value verbatim in :value; for an error object the host can pattern-match {:error_obj, kind, message, irritants} directly, or use irritants/1 for the common case.

This is distinct from Schooner.Eval.Error and Schooner.Primitive.Error, which signal evaluator and primitive failures. Those reach the host directly without passing through the Scheme exception handlers. Values raised from Scheme or through Schooner.Host.raise_error/2 and Schooner.Host.raise_value/1 end up here when unhandled. Host code should use those helpers for errors scripts can catch; raising Schooner.Error directly bypasses Scheme handlers.

Summary

Functions

Return the irritants of error's wrapped value when it is an error object; [] for any other raised value.

Types

t()

@type t() :: %Schooner.Error{
  __exception__: true,
  message: binary() | nil,
  value: Schooner.Value.t()
}

Functions

irritants(error)

@spec irritants(t()) :: [Schooner.Value.t()]

Return the irritants of error's wrapped value when it is an error object; [] for any other raised value.