Report development without the need to restart GnuCash

Derek Atkins warlord at MIT.EDU
Wed May 28 11:05:41 EDT 2008


"Charles Day" <cedayiv at gmail.com> writes:

> How about the following?  I tested by mangling the cash flow report's options
> generator, and the problem was detected. A backtrace is generated, an error is
> logged to the trace file, and the user sees the usual "An error has occurred"
> in the report window. (Note: The last change corrects a genuine bug, which I
> assume was just a typo of "names" vs. "namer".)
>
> I would go ahead and commit this, Derek, but since I'm a reporting API noob,
> perhaps you'd like to take a look first? (Assuming you agree in principle with
> this change.)
>
> -Charles
>
> $ svn diff
> Index: src/report/report-system/report.scm
> ===================================================================
> --- src/report/report-system/report.scm (revision 17174)
> +++ src/report/report-system/report.scm (working copy)
> @@ -253,13 +253,19 @@
>             (gnc:get-html-style-sheets)))))
>  
>      (if (procedure? generator)
> -        (let ((options (generator)))
> +        (let ((options (gnc:backtrace-if-exception generator)))
> +          (if (not options)
> +              (begin
> +                (gnc:warn "BUG DETECTED: exception raised in "
> +                          "report options generator procedure named "
> +                          (procedure-name generator))
> +                (set! options (gnc:new-options))))
>            (gnc:register-option options stylesheet)
>            (gnc:register-option options namer)
>            options)
>          (let ((options (gnc:new-options)))
>             (gnc:register-option options stylesheet)
> -          (gnc:register-option options names)
> +          (gnc:register-option options namer)
>            options))))
>  
>  ;; A <report> represents an instantiation of a particular report type.

Sure, something like this can work.

I'm surprised to see the "namer" vs. "names" thing..  I wonder why that
never caused a problem before?

-derek
-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-user mailing list