gnucash maint: [view-column] refactor to remove reference to gnc:last-captured-error

Christopher Lam clam at code.gnucash.org
Wed Dec 16 20:00:59 EST 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/a1cfdeb6 (commit)
	from  https://github.com/Gnucash/gnucash/commit/5f2a2f46 (commit)



commit a1cfdeb6013422608d099cbd2bf88554cdb7a7d3
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu Dec 17 08:46:58 2020 +0800

    [view-column] refactor to remove reference to gnc:last-captured-error
    
    because gnc:last-captured-error is a global var, and should be removed.

diff --git a/gnucash/report/reports/standard/view-column.scm b/gnucash/report/reports/standard/view-column.scm
index bdce7dd08..b84d536b9 100644
--- a/gnucash/report/reports/standard/view-column.scm
+++ b/gnucash/report/reports/standard/view-column.scm
@@ -116,21 +116,17 @@
 	 (gnc:report-set-stylesheet! 
 	  subreport (gnc:report-stylesheet report))
 	 
-	 ;; render the report body ... hopefully this will DTRT
-	 ;; if there is an error, then dump a backtrace and print
-	 ;; an error message
-	 ;; and cache when it's ok to cache.
-	 (if (not (gnc:backtrace-if-exception
-		   (lambda ()
-		     (gnc:html-table-cell-append-objects! 
-		      contents-cell (gnc:report-render-html subreport #f))
-		     #t)))
-	     (gnc:html-table-cell-append-objects!
-	      contents-cell
-	      (gnc:make-html-text
-	       (gnc:html-markup-h3 (G_ "Report error"))
-               (G_ "An error occurred while running the report.")
-               (gnc:html-markup "pre" gnc:last-captured-error))))
+	 ;; render the report body ... capture error if report crashes.
+         (gnc:html-table-cell-append-objects!
+          contents-cell
+          (match (gnc:apply-with-error-handling
+                  (lambda () (gnc:report-render-html subreport #f)) '())
+            ((html #f) html)
+            ((_ captured-error)
+             (gnc:make-html-text
+              (gnc:html-markup-h3 (G_ "Report error"))
+              (G_ "An error occurred while running the report.")
+              (gnc:html-markup "pre" captured-error)))))
 
 	 ;; increment the alloc number for each occupied row
 	 (let loop ((row current-row-num))



Summary of changes:
 gnucash/report/reports/standard/view-column.scm | 26 +++++++++++--------------
 1 file changed, 11 insertions(+), 15 deletions(-)



More information about the gnucash-changes mailing list