On 2008-01-11 13:57, Dirk Meyer wrote:
> I have no idea what to do in such an exception handler. So Freevo
> raises an AttributeError, what now? I have no idea how to handle

>From the user's perspective I think it would look like:

    import kaa, traceback

    def exception_handler(type, value, tb):
      dump = ''.join(traceback.format_exception(type, value, tb))
      if some_fatal_condition:
         log.error('Exiting due to fatal error foo:', dump)
         kaa.main.quit()
      elif type in (SystemExit, KeyboardInterrupt):
         # User may choose not to quit mainloop on KeyboardInterrupt for
         # some reason.
         kaa.main.quit()
      else:
        # Unhandled exception but not a fatal condition, so we log it
        # but don't quit the mainloop.
        log.exception('Unhandled exception:', dump)

    kaa.signals['exception'].connect(exception_handler)
    kaa.main.run()


I also think that everywhere else in kaa that we're emitting on an
exception signal (for example Thread exception signal, InProgress
exception, etc), we should emit type, value, and traceback args for the
current exception.  Like this:

    try:
       do_callback()
    except Exception, exc:
      self.signals['exception'].emit(exc.__class__, exc, sys.exc_traceback)




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to