diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-06-04 07:56:56 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-06-04 07:56:56 -0700 |
commit | a7aa8066a82ac9fd7d2dffe83503b5db739ce3ec (patch) | |
tree | 4abf79af99d54085f6a90b607718a9aa79d2e42c /eval.c | |
parent | 35a8035e5aa1d624a461a4edf3da948d38ed7f49 (diff) | |
download | txr-a7aa8066a82ac9fd7d2dffe83503b5db739ce3ec.tar.gz txr-a7aa8066a82ac9fd7d2dffe83503b5db739ce3ec.tar.bz2 txr-a7aa8066a82ac9fd7d2dffe83503b5db739ce3ec.zip |
Fixes in field formatting diagnostics.
* eval.c (format_field): Improve error messages; streamline
some code, report expression value rather than expression
itself for bad modifier.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -2172,7 +2172,7 @@ val format_field(val obj, val modifier, val filter, val eval_fun) for (; modifier; pop(&modifier)) { val item = first(modifier); if (regexp(item)) { - uw_throw(query_error_s, lit("bad field format: regex modifier in output")); + uw_throw(query_error_s, lit("bad field format: regex modifier in output var")); } else if (keywordp(item)) { plist = modifier; break; @@ -2191,12 +2191,13 @@ val format_field(val obj, val modifier, val filter, val eval_fun) obj = sub(obj, from, to); } else { val arg = funcall1(eval_fun, arg_expr); - if (bignump(arg) || fixnump(arg)) { + if (integerp(arg)) { obj = ref(obj, arg); } else if (rangep(arg)) { obj = sub(obj, from(arg), to(arg)); } else { - uw_throwf(query_error_s, lit("format_field: bad index: ~s"), + uw_throwf(query_error_s, + lit("bad field format: index ~s expected to be integer or range"), arg, nao); } } @@ -2208,8 +2209,8 @@ val format_field(val obj, val modifier, val filter, val eval_fun) sep = v; else uw_throwf(query_error_s, - lit("bad field format: bad modifier object: ~s"), - item, nao); + lit("bad field format: modifier ~s expected to be fixnum or string"), + v, nao); } } |