Try to print meaningful info about wrapped twisted.web exceptions.
552085
def log_web_failure(err, err_lid=''):
	''
	if err_lid and not err_lid.endswith(' '): err_lid += ' '
	try: err.value.reasons # multiple levels of fail
	except AttributeError: pass
	else: err = err.value
	if hasattr(err, 'reasons'):
		for err in err.reasons:
			lid = '  '
			if isinstance(err, Failure):
				log.error('{}{} {}: {}'.format(err_lid, lid, err.type, err.getErrorMessage()))
				for line in err.getTraceback().splitlines():
					log.error('{}{}   {}'.format(err_lid, lid, line))
			else: log.error('{}{} {}: {}'.format(err_lid, lid, type(err), err))
328152
public static void printInfo(Object message)
	{
		
		if (message instanceof Throwable)
		{

			Throwable e = (Throwable) message;

			getLog(Debugger.class).info(stackTrace(e));
		}
		else

			getLog(Debugger.class).info(message);

	}
63552
def print_exception(exception, secret_values=None):
    
    print(brief_exception_text(exception, secret_values), file=sys.stderr)
932094
def print_errors(function):
    """"""

    def wrapper(*args, **kwargs):
        try:
            return function(*args, **kwargs)
        except BaseException as e:
            print ("Exception raise calling %s: %s"
                   % (reflect.canonical_name(function),
                      get_exception_message(e)))
            raise

    return wrapper
864277
public void printThrowable(Throwable t) {
        final PrintContext context = new PrintContext();

        Throwable prevThrowable = null;
        Throwable currentThrowable = t;
        while (true) {
            printThrowable0(context, currentThrowable, prevThrowable);
            final Throwable nextThrowable = currentThrowable.getCause();
            if (currentThrowable != nextThrowable && nextThrowable != null) {
                prevThrowable = currentThrowable;
                currentThrowable = nextThrowable;
                context.append("Caused by: ");
            } else {
                break;
            }
        }
    }
728704
def print_summary(self):
        
        if self.sources_valid:
            printDebug(
                "----------\nLoaded %d triples.\n----------" % len(
                    self.rdflib_graph),
                fg='white')
            printDebug(
                "RDF sources loaded successfully: %d of %d." %
                (len(self.sources_valid),
                 len(self.sources_valid) + len(self.sources_invalid)),
                fg='green')
            for s in self.sources_valid:
                printDebug("..... '" + s + "'", fg='white')
            printDebug("----------", fg='white')
        else:
            printDebug("Sorry - no valid RDF was found", fg='red')

        if self.sources_invalid:
            printDebug(
                "----------\nRDF sources failed to load: %d.\n----------" %
                (len(self.sources_invalid)),
                fg='red')
            for s in self.sources_invalid:
                printDebug("-> " + s, fg="red")
1153671
def _maybe_wrap_exception(exception):
    """"""
    if isinstance(exception, grpc.RpcError):
        return exceptions.from_grpc_error(exception)
    return exception
488784
def serializeable_exc_info(thetype, ex, tb):
    
    return thetype, ex, ''.join(traceback.format_exception(thetype, ex, tb))
110099
def get_exceptions(self):
          # noqa

        buff = self.get_attribute("Exceptions")
        if buff is None:
            return ()

        with unpack(buff) as up:
            return tuple(self.deref_const(e[0]) for e
                         in up.unpack_struct_array(_H))
110790
def log_exception(self, exception_info: Tuple[type, BaseException, TracebackType]) -> None:
        
        if has_request_context():
            request_ = _request_ctx_stack.top.request
            self.logger.error(
                f"Exception on request {request_.method} {request_.path}",
                exc_info=exception_info,
            )
        if has_websocket_context():
            websocket_ = _websocket_ctx_stack.top.websocket
            self.logger.error(
                f"Exception on websocket {websocket_.path}",
                exc_info=exception_info,
            )
894686
def exception(self, exception):
        """"""
        if self.writelog:
            self.logger.exception(exception)
        if self.verbose:
            for line in  traceback.format_exception(
                    None, exception, exception.__traceback__):
                print(line, end='', file=sys.stderr, flush=True)
619768
def ExceptionHook(exctype, value, tb):
    '''
    

    '''

    for line in traceback.format_exception_only(exctype, value):
        log.error(line.replace('\n', ''))
    for line in traceback.format_tb(tb):
        log.error(line.replace('\n', ''))
    sys.__excepthook__(exctype, value, tb)
640872
def _handle_exception():
    """"""
    # Heavily influenced by logging.Handler.handleError.

    # See note here:
    # https://docs.python.org/3.4/library/sys.html#sys.__stderr__
    if sys.stderr:
        einfo = sys.exc_info()
        try:
            traceback.print_exception(einfo[0], einfo[1], einfo[2],
                                      None, sys.stderr)
        except IOError:
            pass
        finally:
            del einfo
1162395
def catch_exceptions(*exceptions):
    """"""
    def wrap(fn):
        @functools.wraps(fn)
        def wrapped_f(*args, **kwargs):
            try:
                return fn(*args, **kwargs)
            except exceptions:
                t, value, traceback = sys.exc_info()
                # If any resource does not exist, return None instead of raising
                if str(value.status) == '404':
                    return None
                e = CloudApiException(str(value), value.reason, value.status)
                raise_(CloudApiException, e, traceback)
        return wrapped_f
    return wrap
1021176
private void printWarning(PropertyImpl property, Exception exception) throws RepositoryException
   {
      if (PropertyManager.isDevelopping())
      {
         LOG.warn("Binary value reader error, content by path " + property.getPath() + ", property id "
            + property.getData().getIdentifier() + " : " + exception.getMessage(), exception);
      }
      else
      {
         LOG.warn("Binary value reader error, content by path " + property.getPath() + ", property id "
            + property.getData().getIdentifier() + " : " + exception.getMessage());
      }
   }
1321728
def get_details(self):
        

        # transform the dictionary of failures into a printable form
        need_to_print_value = True
        failures_for_print = OrderedDict()
        for validator, failure in self.failures.items():
            name = get_callable_name(validator)
            if isinstance(failure, Exception):
                if isinstance(failure, WrappingFailure) or isinstance(failure, CompositionFailure):
                    need_to_print_value = False
                failures_for_print[name] = '{exc_type}: {msg}'.format(exc_type=type(failure).__name__, msg=str(failure))
            else:
                failures_for_print[name] = str(failure)

        if need_to_print_value:
            value_str = ' for value [{val}]'.format(val=self.wrong_value)
        else:
            value_str = ''

        # OrderedDict does not pretty print...
        key_values_str = [repr(key) + ': ' + repr(val) for key, val in failures_for_print.items()]
        failures_for_print_str = '{' + ', '.join(key_values_str) + '}'

        # Note: we do note cite the value in the message since it is most probably available in inner messages [{val}]
        msg = '{what}{possibly_value}. Successes: {success} / Failures: {fails}' \
              ''.format(what=self.get_what(), possibly_value=value_str,
                        success=self.successes, fails=failures_for_print_str)

        return msg
1327274
def report(
    vulnerabilities,
    fileobj,
    print_sanitised,
):
    
    n_vulnerabilities = len(vulnerabilities)
    unsanitised_vulnerabilities = [v for v in vulnerabilities if not isinstance(v, SanitisedVulnerability)]
    n_unsanitised = len(unsanitised_vulnerabilities)
    n_sanitised = n_vulnerabilities - n_unsanitised
    heading = "{} vulnerabilit{} found{}.\n".format(
        'No' if n_unsanitised == 0 else n_unsanitised,
        'y' if n_unsanitised == 1 else 'ies',
        " (plus {} sanitised)".format(n_sanitised) if n_sanitised else "",
    )
    vulnerabilities_to_print = vulnerabilities if print_sanitised else unsanitised_vulnerabilities
    with fileobj:
        for i, vulnerability in enumerate(vulnerabilities_to_print, start=1):
            fileobj.write(vulnerability_to_str(i, vulnerability))

        if n_unsanitised == 0:
            fileobj.write(color(heading, GOOD))
        else:
            fileobj.write(color(heading, DANGER))