Skip to content

Commit

Permalink
[Reports] Improve error message when html generation fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
jralls committed Jun 2, 2024
1 parent 5c716cc commit 8106ffb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gnucash/report/gnc-report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 8106ffb

Please sign in to comment.