From 15ecf114c64e65f2b102946e18665a53e1a7e70a Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sat, 2 Jan 2021 21:45:45 +0800 Subject: [PATCH] [gnucash-commands.cpp] display report errors to stderr --- gnucash/gnucash-commands.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gnucash/gnucash-commands.cpp b/gnucash/gnucash-commands.cpp index 4b1bd84485..488a93cb99 100644 --- a/gnucash/gnucash-commands.cpp +++ b/gnucash/gnucash-commands.cpp @@ -260,9 +260,9 @@ return a document object with export-string or export-error.") << std::endl; if (scm_is_false (id)) scm_cleanup_and_exit_with_failure (nullptr); - char* html; - gnc_run_report (scm_to_int(id), &html); - if (html && *html) + char *html, *errmsg; + + if (gnc_run_report_with_error_handling (scm_to_int(id), &html, &errmsg)) { if (!args->output_file.empty()) { @@ -273,6 +273,10 @@ return a document object with export-string or export-error.") << std::endl; std::cout << html << std::endl; } } + else + { + std::cerr << errmsg << std::endl; + } } qof_session_destroy (session);