From 1151b2c402825e7ca68038c19ffcd2775ed5c55f Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sat, 2 Jan 2021 21:15:48 +0800 Subject: [PATCH] [report-core.scm] create and expose gnc:render-report similar to gnc:report-run but *always* returns a 2-element list containing data OR captured_error --- gnucash/report/report-core.scm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gnucash/report/report-core.scm b/gnucash/report/report-core.scm index 3b56f04e61..931f873a3b 100644 --- a/gnucash/report/report-core.scm +++ b/gnucash/report/report-core.scm @@ -76,6 +76,7 @@ (export gnc:report-needs-save?) (export gnc:report-options) (export gnc:report-render-html) +(export gnc:render-report) (export gnc:report-run) (export gnc:report-serialize) (export gnc:report-set-ctext!) @@ -763,9 +764,17 @@ not found."))) (gnc:report-set-dirty?! report #f) ;; mark it clean html))))) +;; render report. will return a 2-element list: either (list html #f) +;; where html is the report html string, or (list #f captured-error) +;; where captured-error is the error string. +(define (gnc:render-report report) + (define (get-report) (gnc:report-render-html report #t)) + (gnc:apply-with-error-handling get-report '())) + ;; looks up the report by id and renders it with gnc:report-render-html ;; marks the cursor busy during rendering; returns the html (define (gnc:report-run id) + (issue-deprecation-warning "gnc:report-run is deprecated. use gnc:render-report instead.") (let ((report (gnc-report-find id)) (html #f)) (gnc-set-busy-cursor '() #t)