cpp branch

Geert Janssens geert.gnucash at kobaltwit.be
Tue Feb 21 10:07:28 EST 2017


Op dinsdag 21 februari 2017 11:33:08 CET schreef Robert Fewell:
> Geert,
> 
> Just an observation, when I do an import and select the date column first
> with an invalid default format, the view goes red and the error message
> tells me what is wrong. At the same time I ended up with 20 WARN messages,
> one for each line in the trace file. I was wondering if
> gnc_dmy2timespec_neutral should have an extra parameter to suppress the
> WARN messages in this use. I can not really decide whether this is
> worthwhile or not.
> 
> Bob

Bob,

Yes, I have seen those warnings also. They have started when John fixed the c 
interface to no longer throw exceptions.

I don't think we should add an extra parameter to gnc_dmy2timespec_neutral 
though.

IMO the fix is to integrate the functionality of that function directly into 
GncDateTime in a way that does throw exceptions on failure. I haven't 
investigated the best way to do this yet. An initial idea is to add a 
constructor to GncDateTime that takes a day, month, year and an extra enum 
argument (START, END, NEUTRAL) and generate the appropriate time depending on 
this. Optionally this constructor could also be overloaded to accept a GncDate 
and the enum for the same result.

Then we can make gnc_dmy2timespec_neutral just call into GncDateTime and 
handle the exceptions for the c code.

C++ code on the other hand should use the appropriate GncDateTime constructor 
and handle any exception thrown.

I didn't say it with so many words in bug 778982 [1], but it was and still is 
my intention to do this as part of solving this bug.

Geert

[1] https://bugzilla.gnome.org/show_bug.cgi?id=778982


More information about the gnucash-devel mailing list