From 4a90f13dee78d00a954f8931ff8be4676fbdd797 Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Thu, 23 Jul 2020 00:27:31 +0200 Subject: [PATCH] better error handling for options --- src/lib/charsio.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/charsio.pl b/src/lib/charsio.pl index dd41a597..71223884 100644 --- a/src/lib/charsio.pl +++ b/src/lib/charsio.pl @@ -200,6 +200,8 @@ read_line_to_chars(Stream, Cs0, Cs) :- Relation between a list of characters Cs and its Base64 encoding Bs, also a list of characters. + At least one of the arguments must be instantiated. + Options are: - padding(Boolean) @@ -226,6 +228,10 @@ chars_base64(Cs, Bs, Options) :- ) ), must_be(boolean, Padding), + must_be(atom, Charset), + ( member(Charset, [standard,url]) -> true + ; domain_error(charset, Charset, chars_base64/3) + ), ( var(Cs) -> must_be(list, Bs), maplist(must_be(character), Bs), -- 2.54.0