]> Repositorios git - scryer-prolog.git/commitdiff
throw instantiation_error from error/2 if Error_term uninstantiated (#2060)
authorMark <[email protected]>
Sun, 1 Oct 2023 04:22:01 +0000 (22:22 -0600)
committerMark <[email protected]>
Sun, 1 Oct 2023 04:35:46 +0000 (22:35 -0600)
src/lib/builtins.pl

index ec5a99681b32e663f5b134e0ce45d23c38dc911a..b7b60df9aa5ae9f1318588be8dc3cf50f29ad707 100644 (file)
@@ -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))
+    ).