Episteme.Builtins.Exceptions (Episteme v0.1.0)

Copy Markdown View Source

Standard ISO error-term constructors (type_error/2, domain_error/2, instantiation_error/1) plus the raw Elixir throw tag Episteme's own throw/1/catch/3 (in Episteme.Engine, which needs to solve the recovery goal) and every builtin that detects bad input raise through.

Deliberately a different Elixir throw tag from cut's own {:episteme_cut, barrier} (Episteme.Engine) -- the two mechanisms are unrelated non-local exits sharing nothing but the throw/catch primitive, and must never be caught by each other's guard.

Summary

Functions

error(domain_error(Domain, Culprit), _) -- ISO's standard shape for "right kind, wrong value".

error(existence_error(Type, Culprit), _) -- ISO's standard shape for "no such procedure/entity".

error(instantiation_error, _) -- ISO's standard shape for "needed a bound term, got an unbound variable".

Raises a real Prolog exception carrying term -- caught by catch/3, or escapes to the top level otherwise.

error(type_error(Type, Culprit), _) -- ISO's standard shape for "wrong kind of value".

Functions

domain_error(domain, culprit)

@spec domain_error(atom(), term()) :: term()

error(domain_error(Domain, Culprit), _) -- ISO's standard shape for "right kind, wrong value".

existence_error(type, culprit)

@spec existence_error(atom(), term()) :: term()

error(existence_error(Type, Culprit), _) -- ISO's standard shape for "no such procedure/entity".

instantiation_error()

@spec instantiation_error() :: term()

error(instantiation_error, _) -- ISO's standard shape for "needed a bound term, got an unbound variable".

prolog_throw(term)

@spec prolog_throw(term()) :: no_return()

Raises a real Prolog exception carrying term -- caught by catch/3, or escapes to the top level otherwise.

type_error(type, culprit)

@spec type_error(atom(), term()) :: term()

error(type_error(Type, Culprit), _) -- ISO's standard shape for "wrong kind of value".