Update Manager API: BugHandler module

BugHandler module

Classes

class UpdateManager.BugHandler.BugHandler

BugHandler class.

Provides the excepthook function and all error reporting logic.

classmethod bug_script_invoke(path, ex_type, ex_value, ex_tb, ex_origin)
classmethod bug_script_path(bug_script_name)
classmethod excepthook(ex_type, ex_value, ex_tb)

Exception hook method.

This method is invoked when an unhandled exception occurs anywhere in the program. If no exception handler has been installed yet sys.__excepthook__ will be invoked.

Note

This method will exit the program through os._exit and this way kill every running thread.

classmethod initialize(application)

Initializes the ExceptionHandler.

Parameter:applicationUpdateManager.Application.Application object
classmethod install_handler(handler)

Installs an exception handler.

Parameter:handlerExceptionHandlerBase implementation class.

Note

This method takes a class as handler parameter, not an instance!

class UpdateManager.BugHandler.Thread(group=None, target=None, name=None, args=(), kwargs=None, verbose=None)

A special implementation of threading.Thread which does not do ‘intelligent’ processing of exceptions inside threads.

run(*args, **kwargs)

This method is the core logic of Thread.

It differs from the original threading.Thread in the way exceptions are processed. This version doesn’t process them, but rather lets sys.excepthook do its magic.

Interfaces

class UpdateManager.BugHandler.ExceptionHandlerBase
classmethod handle_exception(ex_type, ex_value, ex_tb, ex_origin, with_script)

Exception handling method.

Parameters:
  • ex_type – Exception type
  • ex_value – Exception value
  • ex_tb – Exception traceback
  • ex_origin – Thread this exception originated from
  • with_script – Set to True if a bug script will be executed.

Note

This method will be invoked by the special Exception Handler Thread, so make sure you do not invoke functions which are not thread-safe.

Note

If you return from this function execution of all threads will be resumed. However, correct execution can not be guaranteed after the exception has been raised, so consider using sys.exit in the implementation of this method.

classmethod pre_handle_exception()

Method to be called before handle_exception is invoked.

Do any preparation for the actual handling of the exception here. This method is optional.

Table Of Contents

Previous topic

Update Manager API: Backend.loader module

Next topic

Update Manager API: Config module

This Page