mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[window-report] show backtrace when report crashes
* exposes a SCM string last-captured-error containing last backtrace * when rendering report-crash window, include it
This commit is contained in:
parent
a259ba4a3e
commit
9832fa397a
@ -274,10 +274,16 @@ gnc_html_report_stream_cb (const char *location, char ** data, int *len)
|
|||||||
|
|
||||||
if (!ok)
|
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 ("<html><body><h3>%s</h3>"
|
*data = g_strdup_printf ("<html><body><h3>%s</h3>"
|
||||||
"<p>%s</p></body></html>",
|
"<p>%s</p><pre>%s</pre></body></html>",
|
||||||
_("Report error"),
|
_("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 sure the progress bar is finished, which will also
|
||||||
make the GUI sensitive again. Easier to do this via guile
|
make the GUI sensitive again. Easier to do this via guile
|
||||||
|
@ -63,14 +63,17 @@
|
|||||||
(define (gnc:backtrace-if-exception proc . args)
|
(define (gnc:backtrace-if-exception proc . args)
|
||||||
(let* ((apply-result (gnc:apply-with-error-handling proc args))
|
(let* ((apply-result (gnc:apply-with-error-handling proc args))
|
||||||
(result (car apply-result))
|
(result (car apply-result))
|
||||||
(error (cadr apply-result)))
|
(captured-error (cadr apply-result)))
|
||||||
(cond
|
(cond
|
||||||
(error
|
(captured-error
|
||||||
(display error (current-error-port))
|
(display captured-error (current-error-port))
|
||||||
|
(set! gnc:last-captured-error (gnc:html-string-sanitize captured-error))
|
||||||
(when (defined? 'gnc:warn)
|
(when (defined? 'gnc:warn)
|
||||||
(gnc:warn error)))
|
(gnc:warn captured-error)))
|
||||||
(else result))))
|
(else result))))
|
||||||
|
|
||||||
|
(define-public gnc:last-captured-error "")
|
||||||
|
|
||||||
;; This database can be used to store and retrieve translatable
|
;; This database can be used to store and retrieve translatable
|
||||||
;; strings. Strings that are returned by the lookup function are
|
;; strings. Strings that are returned by the lookup function are
|
||||||
;; translated with gettext.
|
;; translated with gettext.
|
||||||
|
Loading…
Reference in New Issue
Block a user