From f28e87b2401960e3b31bea114318e2b3ef1616d3 Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Sat, 18 Apr 2020 14:38:03 +0200 Subject: [PATCH] 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. --- src/prolog/lib/charsio.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)) ). -- 2.54.0