Whenever the Prolog system encounters a situation where it cannot continue
execution, it throws an exception. For example, if a built-in predicate
detects an argument of the wrong type, it throws a type_error
exception. The manual page description of each built-in predicate lists the
kinds of exceptions that can be thrown by that built-in predicate.
The default effect of throwing an exception is to terminate the current computation and then print an error message. After the error message, you are back at Prolog's top-level. For example, if the goal
X is a/2
is executed somewhere in a program you get
! Type error in argument 2 of (is)/2 ! expected evaluable, but found a/0 ! goal: _255 is a/2 | ?-
Particular things to notice in this message are:
Built-in predicates check their arguments, but predicates exported by library modules generally don't, although some do check their arguments to a lesser or greater extent.
[1] The difference between an error (including exceptions) and a warning: A warning is issued if Prolog detects a situation that is likely to cause problems, though it is possible that you intended it. An error, however, indicates that Prolog recognizes a situation where it cannot continue.