Example #1
0
def _getTraceback(err, errtype, traceback):
    # Get server traceback (if any)
    if hasattr(err, "traceback") and err.traceback:
        server = list(err.traceback)
        server = _cleanupTraceback(server, tr("Server backtrace:"))
    else:
        server = u''

    # Get client (local) traceback
    info = None
    if traceback is None:
        try:
            info = sys.exc_info()
            sys.exc_clear()
        except Exception:
            info = None
    else:
        info = (errtype, err, traceback)
    if info:
        client = formatTraceback(info)
        client = _cleanupTraceback(client, tr("Client backtrace:"))
    else:
        client = u''

    return server + client
Example #2
0
 def encodeError(self, context, err, traceback):
     info = {'type': err.__class__.__name__}
     if isinstance(err, UnicodeException):
         info['format'] = err.format
         info['application'] = err.application
         info['component'] = err.component
         info['error_code'] = err.error_code
         if err.format_arguments:
             info['arguments'] = err.format_arguments
         if err.additionals:
             info['additional'] = err.additionals
     else:
         info['message'] = exceptionAsUnicode(err, add_type=False)
     if traceback and context and context.hasRole("nucentral_debug"):
         info['traceback'] = formatTraceback(traceback)
     return info