def __init__(self, exc_info): e = exc_info[1] log.error(repr(e)) body_template = "<b>${explanation}</b>\n<hr/>\n" cls = e.__class__.__name__ if not e.args: self.explanation = "%s" % cls else: self.explanation = "%s: %s" % (cls, e.args[0]) if log.getEffectiveLevel() > logging.DEBUG: # no debug detail = production_error_msg % \ rnaseqlyze.admin_email body_template += "${detail}" else: # debug detail = '' if isinstance(e, DBAPIError): detail += dberror_msg import traceback detail += '%s\n\nStack trace:\n' % e detail += ''.join(traceback.format_tb(exc_info[2])) log.debug(detail) body_template += "<pre>\n${detail}</pre>" HTTPError.__init__(self, detail, body_template=body_template)
def __init__(self, exc_info): import traceback err = exc_info[1] message = [ self.title, " - ", brep(err), '\n\nStack trace:\n' ] + \ traceback.format_tb(exc_info[2]) log.error(brep(err)) log.debug(''.join(message)) HTTPError.__init__(self, app_iter=message, content_type='text/plain')