FASILL documentation Source fasill_exceptions

Exceptions

This library provides basic predicates for making and throwing errors.

FASILL provides an exception handling mechanism, based on the builtin control constructs catch/3 and throw/1. When an error occurs the current goal is replaced by a goal:

throw(error(ErrorTerm, ImplementationDefinedTerm))

  • instantiation_error: an argument or one of its components is a variable, and an instantiated argument or component is required.

  • type_error: the type of an argument or of one of its components is incorrect, but not a variable.

  • evaluation_error: the operands of an evaluable functor has an exceptional value.

  • existence_error: the object on which an operation is to be performed does not exist.

  • domain_error: the type of an argument is correct but the value is outside the domain for which the procedure is defined.

  • syntax_error: a sequence of incorrect characters are being input as a read term.

throw_exception/1

throw_exception( +Exception )

This predicate throws the exception Exception.

clear_warnings/0

clear_warnings

This predicate clears all the current warning.

throw_warning/1

throw_warning( +Warning )

This predicate throws the warning +Warning.

instantiation_error/2

instantiation_error( +Indicator, ?Error )

This predicate succeeds when Error is the instantiation error produced by the predicate Indicator. This error is produced when an argument or one of its components is a variable, and an instantiated argument or component is required.

type_error/4

type_error( +Type, +Term, +Indicator, ?Error )

This predicate succeeds when Error is the type error produced by the type Type of the term Term in the predicate Indicator. This error is produced when the type of an argument or of one of its components is incorrect, but not a variable.

evaluation_error/3

evaluation_error( +Cause, +Indicator, ?Error )

This predicate succeeds when Error is the evaluation error produced by the cause Cause in the predicate Indicator. This error is produced when the operands of an evaluable functor has an exceptional value.

existence_error/4

existence_error( +Cause, +Term, +Indicator, ?Error )

This predicate succeeds when Error is the existence error produced by the term Term in the predicate Indicator. This error is produced when the object on which an operation is to be performed does not exist.

domain_error/3

domain_error( +Domain, +Indicator, ?Error )

This predicate succeeds when Error is the domain error produced by the term Term in the predicate Indicator. This error is produced when the type of an argument is correct but the value is outside the domain for which the procedure is defined.

syntax_error/4

syntax_error( +Line, +Columns, +Message, ?Error )

This predicate succeeds when Error is the syntax error produced in line Line and Column Column with message Message. This error is produced when a sequence of incorrect characters are being input as a read term.