← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/except-hook into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/except-hook into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  #635515 New Error Handling window crashes
  https://bugs.launchpad.net/bugs/635515


As per the last revision's commit message.
-- 
https://code.launchpad.net/~raoul-snyman/openlp/except-hook/+merge/35463
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/except-hook into lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw	2010-09-07 20:42:33 +0000
+++ openlp.pyw	2010-09-14 20:11:05 +0000
@@ -147,6 +147,9 @@
         return self.exec_()
 
     def hookException(self, exctype, value, traceback):
+        if not hasattr(self, u'mainWindow')
+            log.exception(''.join(format_exception(exctype, value, traceback)))
+            return
         if not hasattr(self, u'exceptionForm'):
             self.exceptionForm = ExceptionForm(self.mainWindow)
         self.exceptionForm.exceptionTextEdit.setPlainText(
@@ -161,6 +164,9 @@
     # Set up command line options.
     usage = u'Usage: %prog [options] [qt-options]'
     parser = OptionParser(usage=usage)
+    parser.add_option("-e", "--no-error-form", dest="no_error_form",
+                      action="store_true",
+                      help="Disable the error notification form.")
     parser.add_option("-l", "--log-level", dest="loglevel",
                       default="warning", metavar="LEVEL",
                       help="Set logging to LEVEL level. Valid values are "
@@ -203,7 +209,8 @@
     language = LanguageManager.get_language()
     appTranslator = LanguageManager.get_translator(language)
     app.installTranslator(appTranslator)
-    sys.excepthook = app.hookException
+    if not options.no_error_form:
+        sys.excepthook = app.hookException
     sys.exit(app.run())
 
 if __name__ == u'__main__':


Follow ups