Error Classes

Exceptions raised by the Prolog system are called errors. The set of exception classes used by the system has been kept small. Here is a complete list:


Instantiation Error
An input argument is insufficiently instantiated.
Type Error
An input argument is of the type.
Domain Error
An input argument is illegal but of the right type.
Range Error
A value specified for an output argument is illegal.
Representation Error
A computed value cannot be represented.
Existence Error
Something does not exist.
Permission Error
Specified operation is not permitted.
Context Error
Specified operation is not permitted in this context.
Consistency Error
Two otherwise correct values are inconsistent with each other.
Syntax Error
Error in reading a term.
Resource Error
Some resource limit has been exceeded.
System Error
An error detected by the operating system.

The exception codes corresponding to these classes are:

Most exception codes include a copy of the Goal that raised the exception.

In general, built-in predicates that cause side-effects, such as the opening of a stream or asserting a clause into the Prolog database, attempt to do all error checking before the side-effect is performed. Unless otherwise indicated in the documentation for a particular predicate or error class, it should be assumed that goals that raise exceptions have not performed any side-effect.