diff --git a/gnucash/report/report-gnome/window-report.c b/gnucash/report/report-gnome/window-report.c index d884df647c..077650584c 100644 --- a/gnucash/report/report-gnome/window-report.c +++ b/gnucash/report/report-gnome/window-report.c @@ -274,10 +274,16 @@ gnc_html_report_stream_cb (const char *location, char ** data, int *len) if (!ok) { + SCM captured = scm_c_eval_string ("gnc:last-captured-error"); + gchar *captured_str = gnc_scm_to_utf8_string(captured); + *data = g_strdup_printf ("

%s

" - "

%s

", + "

%s

%s
", _("Report error"), - _("An error occurred while running the report.")); + _("An error occurred while running the report."), + captured_str); + + g_free (captured_str); /* Make sure the progress bar is finished, which will also make the GUI sensitive again. Easier to do this via guile diff --git a/libgnucash/app-utils/c-interface.scm b/libgnucash/app-utils/c-interface.scm index 8dba2b9855..8c0b74b464 100644 --- a/libgnucash/app-utils/c-interface.scm +++ b/libgnucash/app-utils/c-interface.scm @@ -63,14 +63,17 @@ (define (gnc:backtrace-if-exception proc . args) (let* ((apply-result (gnc:apply-with-error-handling proc args)) (result (car apply-result)) - (error (cadr apply-result))) + (captured-error (cadr apply-result))) (cond - (error - (display error (current-error-port)) + (captured-error + (display captured-error (current-error-port)) + (set! gnc:last-captured-error (gnc:html-string-sanitize captured-error)) (when (defined? 'gnc:warn) - (gnc:warn error))) + (gnc:warn captured-error))) (else result)))) +(define-public gnc:last-captured-error "") + ;; This database can be used to store and retrieve translatable ;; strings. Strings that are returned by the lookup function are ;; translated with gettext.