gnucash stable: [Reports] Improve error message when html generation fails.
John Ralls
jralls at code.gnucash.org
Sun Jun 2 17:31:59 EDT 2024
Updated via https://github.com/Gnucash/gnucash/commit/8106ffb8 (commit)
from https://github.com/Gnucash/gnucash/commit/5c716cc9 (commit)
commit 8106ffb84bfe20583c18b3ecebc69623ebeed157
Author: John Ralls <jralls at ceridwen.us>
Date: Tue May 28 13:08:57 2024 -0700
[Reports] Improve error message when html generation fails.
Per Chris Lam's comment 7 on https://bugs.gnucash.org/show_bug.cgi?id=799148.
diff --git a/gnucash/report/gnc-report.cpp b/gnucash/report/gnc-report.cpp
index 39742f3f67..8146b79252 100644
--- a/gnucash/report/gnc-report.cpp
+++ b/gnucash/report/gnc-report.cpp
@@ -230,10 +230,17 @@ gnc_run_report_with_error_handling (gint report_id, gchar ** data, gchar **errms
}
else
{
- *errmsg = scm_is_string (captured_error) ? gnc_scm_to_utf8_string (captured_error) :
+ constexpr const char* with_err = "Report %s failed to generate html: %s";
+ constexpr const char* without_err = "Report %s Failed to generate html but didn't raise a Scheme exception.";
+ auto scm_err = scm_is_string (captured_error) ? gnc_scm_to_utf8_string (captured_error) :
g_strdup ("");
+
+ if (scm_err && *scm_err)
+ *errmsg = g_strdup_printf (with_err, gnc_report_name (report), scm_err);
+ else
+ *errmsg = g_strdup_printf (without_err, gnc_report_name (report));
+
*data = nullptr;
- PWARN ("Error in report: %s", *errmsg);
return FALSE;
}
}
Summary of changes:
gnucash/report/gnc-report.cpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
More information about the gnucash-changes
mailing list