示例#1
0
 def _Run(self, loggingState):
     """Execute the function associated with the thread."""
     try:
         if loggingState is not None:
             cx_Logging.SetLoggingState(loggingState)
         self.OnThreadStart()
         try:
             self.function(*self.args, **self.keywordArgs)
         except:
             cx_Logging.Error("Exception in thread %s" % self.name)
             self.errorObj = cx_Exceptions.GetExceptionInfo(*sys.exc_info())
             cx_Logging.Error("    Message: %s" % self.errorObj.message)
             cx_Logging.Error("    TemplateId: %s" % \
                     self.errorObj.templateId)
             cx_Logging.Error("    Arguments:")
             for name, value in self.errorObj.arguments.iteritems():
                 cx_Logging.Error("        %s -> %r" % (name, value))
             cx_Logging.Error("    Traceback:")
             for line in self.errorObj.traceback:
                 cx_Logging.Error("        %s" % line)
             cx_Logging.Error("    Details:")
             for line in self.errorObj.details:
                 cx_Logging.Error("        %s" % line)
             cx_Logging.Error("Thread terminating")
     finally:
         self.stopped = True
         self.OnThreadEnd()
         if self.event:
             self.event.Set()
示例#2
0
 def __exit__(self, excType, excValue, excTraceback):
     if self.raiseException and excValue is not None:
         app = wx.GetApp()
         exc = cx_Exceptions.GetExceptionInfo(excType, excValue,
                                              excTraceback)
         app.OnException(exc, self.parent)
         return True
示例#3
0
 def ExceptionHandler(self, excType, excValue, excTraceback):
     if excType is None or excValue is None \
             or not isinstance(excValue, cx_Oracle.DatabaseError):
         exc = cx_Exceptions.GetExceptionInfo(excType, excValue,
                                              excTraceback)
     else:
         exc = DatabaseException(excType, excValue, excTraceback,
                                 self.trimMessage)
     exc.arguments["connection"] = repr(self)
     return exc
示例#4
0
def ExceptionHandler(excType, excValue, traceback):
    """Exception handler suitable for placing in sys.excepthook."""
    error = cx_Exceptions.GetExceptionInfo(excType, excValue, traceback)
    fullTraceback = not hasattr(sys, "tracebacklimit")
    if fullTraceback:
        cx_Logging.LogException(error)
    else:
        cx_Logging.Error("%s", error.message)
    if sys.stdout.isatty() and not sys.stderr.isatty():
        print(error.message)
        if fullTraceback:
            print("See log file for more details.")
示例#5
0
 def __call__(self, event):
     try:
         if self.createBusyCursor:
             busyCursor = wx.BusyCursor()
         if self.passEvent:
             self.method(event)
         else:
             self.method()
         if self.skipEvent:
             event.Skip()
     except:
         app = wx.GetApp()
         exc = cx_Exceptions.GetExceptionInfo(*sys.exc_info())
         app.OnException(exc, self.parent)
示例#6
0
 def _ExceptionHandler(self, excType, excValue, excTraceback):
     exc = cx_Exceptions.GetExceptionInfo(excType, excValue, excTraceback)
     self.OnException(exc)
示例#7
0
 def ExceptionHandler(self, excType, excValue, excTraceback):
     if excType is None or excValue is None \
             or not isinstance(excValue, cx_Oracle.DatabaseError):
         return cx_Exceptions.GetExceptionInfo(excType, excValue,
                                               excTraceback)
     return DatabaseException(excType, excValue, excTraceback)