diff --git a/src/lib/builtins.pl b/src/lib/builtins.pl index ec5a9968..b7b60df9 100644 --- a/src/lib/builtins.pl +++ b/src/lib/builtins.pl @@ -2226,4 +2226,7 @@ nl(Stream) :- % % Throws an exception of the following structure: `error(ErrorTerm, ImpDef)`. error(Error_term, Imp_def) :- - throw(error(Error_term, Imp_def)). + ( var(Error_term) -> + throw(error(instantiation_error, error/2)) + ; throw(error(Error_term, Imp_def)) + ).