From 4f56ce6d335ae8476499d997ea3296a738b166d8 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 15 Feb 2018 15:00:11 +0100 Subject: [PATCH] [math] Improve error formatting This looked like math: Error in expression 'sin(5,4)' ^ Too many arguments Now it looks like math: Too many arguments 'sin(5,4)' ^ --- src/builtin_math.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/builtin_math.cpp b/src/builtin_math.cpp index 55df31e0b..fee462418 100644 --- a/src/builtin_math.cpp +++ b/src/builtin_math.cpp @@ -152,11 +152,9 @@ static int evaluate_expression(const wchar_t *cmd, parser_t &parser, io_streams_ } } else { // TODO: Better error reporting! - streams.err.append(L"math: Error in expression\n"); + streams.err.append_format(L"%ls: Error: %ls\n", cmd, math_describe_error(error).c_str()); streams.err.append_format(L"'%ls'\n", expression.c_str()); streams.err.append_format(L"%*lc^\n", error.position - 1, L' '); - streams.err.append(math_describe_error(error)); - streams.err.append(L"\n"); } free(narrow_str); free(saved_locale);