raise_exception/1

Synopsis

raise_exception(+Exception)

Raise an exception (that might be intercepted by on_exception/3).

Arguments


Exception nonvar
Any term.

Description

A call to raise_exception/1 can never backtrack, fail or succeed. Rather, raise_exception/1 searches for an ancestor of the current goal, ProtectedGoal, which is of the form:

     on_exception(E,ProtectedGoal,Handler)
     

The first argument, E, unifies with Exception. It then executes the Handler instead of the ProtectedGoal. It will always find a handler at the top level, which prints out a message corresponding to the exception. See ref-msg-tbm for a discussion on how exceptions are printed.

Exceptions


instantiation_error
when Exception is unbound. When a built-in predicate detects an error situation, it causes an exception to be raised.

See Also

on_exception/3. ref-ere