'Called within an except block to allow converting exceptions
to abitrary responses. Anything returned (except None) will
be used as response.'

def _handle_exception(self, exception):

    self._failed = exception
    if ((not isinstance(exception, NO_POSTMORTEM)) and (not isinstance(exception, werkzeug.exceptions.HTTPException))):
        odoo.tools.debugger.post_mortem(odoo.tools.config, sys.exc_info())
    raise
