]> Repositorios git - scryer-prolog.git/commitdiff
instead of a type error, use a domain error
authorMarkus Triska <[email protected]>
Sat, 18 Apr 2020 12:38:03 +0000 (14:38 +0200)
committerMarkus Triska <[email protected]>
Sat, 18 Apr 2020 12:39:30 +0000 (14:39 +0200)
The preceding use of atom_length/2 already ensures that C has the
correct type (i.e., atom). However, its domain may still be wrong,
if its length is greater than 1.

src/prolog/lib/charsio.pl

index 5fde900c83fc74179cbda6eca9bb4d6d829e7f6b..29a668fd84b829926da0ea070ecbbdc05e8cf699 100644 (file)
@@ -61,7 +61,7 @@ get_single_char(C) :-
     (  var(C) -> '$get_single_char'(C)
     ;  C == end_of_file  -> '$get_single_char'(C)
     ;  atom_length(C, 1) -> '$get_single_char'(C)
-    ;  throw(error(type_error(in_character, C), get_char/1))
+    ;  throw(error(domain_error(in_character, C), get_char/1))
     ).