From 159139d01de827e8e7232e2b74b2fc142612d8e2 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 4 May 2021 07:25:40 -0700 Subject: format: use self variable in error messages. * stream.c (formatv): Replace hard-coded "format:" with ~a and self argument. Several error messages are revised. --- stream.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stream.c b/stream.c index b565b57e..f24f7eff 100644 --- a/stream.c +++ b/stream.c @@ -3497,9 +3497,9 @@ val formatv(val stream_in, val fmtstr, struct args *al) n = convert(double, c_num(obj, self)); break; default: - uw_throwf(error_s, lit("format: ~~~a conversion requires " + uw_throwf(error_s, lit("~a: ~~~a conversion requires " "numeric arg: ~s given"), - chr(ch), obj, nao); + self, chr(ch), obj, nao); } if (!precision_p) { @@ -3510,8 +3510,8 @@ val formatv(val stream_in, val fmtstr, struct args *al) /* guard against num_buf overflow */ if (precision > 128) - uw_throwf(error_s, lit("excessive precision in format: ~s"), - num(precision), nao); + uw_throwf(error_s, lit("~a: excessive precision: ~s"), + self, num(precision), nao); if (ch == 'e') { sprintf(num_buf, "%.*e", precision, n); @@ -3612,8 +3612,8 @@ val formatv(val stream_in, val fmtstr, struct args *al) } if (precision > 500) - uw_throwf(error_s, lit("excessive precision in format: ~s"), - num(precision), nao); + uw_throwf(error_s, lit("~a: excessive precision: ~s"), + self, num(precision), nao); sprintf(num_buf, "%.*g", precision, obj->fl.n); -- cgit v1.2.3