Whenever the Prolog system encounters a situation where it cannot continue
execution, it raises an exception. For example, if a built-in predicate
detects an argument of the wrong type, it raises a
exception. The manual page description of each built-in predicate lists the
kinds of exceptions that can be raised by that built-in predicate.
The default effect of raising 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 number, but found a ! goal: A is a/2 | ?-
Particular things to notice in this message are:
 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.