From: Markus Triska Date: Sat, 18 Apr 2020 12:38:03 +0000 (+0200) Subject: instead of a type error, use a domain error X-Git-Tag: v0.8.123~139 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=f28e87b2401960e3b31bea114318e2b3ef1616d3;p=scryer-prolog.git instead of a type error, use a domain error 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. --- diff --git a/src/prolog/lib/charsio.pl b/src/prolog/lib/charsio.pl index 5fde900c..29a668fd 100644 --- a/src/prolog/lib/charsio.pl +++ b/src/prolog/lib/charsio.pl @@ -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)) ).