Hi Paul, I have to agree with you, it also bothers me to just log, but i really think raising the exception as a default is bad for dabo, i already have the handling code you suggest in my apps, i think we have two choices:
- write a log error - raise an exception, but have a default handler for that exception that informs the user about the problem In the "raise an exception, and hope for someone to catch it" scenario, an unxeperient coder (i'm quite new to dabo, so maybe i'm one of those) will only detect this problem when it may already be too late, thus giving dabo a bad image... Maybe we should go with the second one, have a default exception handler? Regards, Pedro Paul McNett escreveu: > Pedro Vale de Gato wrote: > >> dabo Commit >> Revision 5137 >> Date: 2009-03-19 13:07:28 -0700 (Thu, 19 Mar 2009) >> Author: Pedro.Gato >> Trac: http://trac.dabodev.com/changeset/5137 >> >> Changed: >> U trunk/dabo/ui/uiwx/dControlItemMixin.py >> >> Log: >> If the correct key is not present in the list of keys the default behaviour >> was to raise an exception, which would result in semi-filled forms, log the >> error, but continue. >> > > I think the correct behavior is to raise the exception. If the control is > getting set > to a Value that doesn't exist in the Keys, then something is wrong and the > exception > bluntly informs you of this. > > If your UI wants to catch and ignore this exception, you can do it like this > in your > subclass: > > def update(self, *args, **kwargs): > try: > self.super(*args, **kwargs) > except ValueError: > print "oops" > > I've been inconvenienced by this exception too, believe me. But, I was > getting the > exception because I wasn't being careful enough in my code, so it was *good* > that I > was inconvenienced by it. > > With this change, I'm never going to know when/if this happens again at a > client > site, and because their program will no longer stop at this exceptional > condition, > they may be working with corrupt data and never know it, my program won't > know it, etc. > > When an unhandled exception happens in my programs, a nice UI is displayed to > the > user, they can enter notes, and I get a detailed email within minutes. Now > I'll never > know that it happened unless I want to write code to send me people's error > logs, > which I redirect to their user app directory. > > How do others feel about this issue? > > BTW, we were logging the error instead of raising the exception until fairly > recently > (6-8 months?). > > The partially filled form happens because the exception wasn't caught, and > the > wxPython event loop wasn't ended. I've always been a bit bothered by this > behavior... > perhaps we should do a sys.exit() after any exception to make sure the > program can't > continue, but that's a different issue. > > Paul > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev Searchable Archives: http://leafe.com/archives/search/dabo-dev This message: http://leafe.com/archives/byMID/[email protected]
