def report_error(failure, line_fun=None, include_stacktrace=True): if line_fun is None: def line_fun(line): logger.debug(line) if isinstance(failure, SshFailure): return failure if hasattr(failure.value, 'component'): line_fun('%s%s: %s' % (_determine_issued_command(failure), failure.value.component, failure.getErrorMessage())) else: line_fun(failure.getErrorMessage()) if include_stacktrace: for line in failure.getBriefTraceback().splitlines(): line_fun(line) return failure
def report_error(failure, line_fun=None, include_stacktrace=False): if getattr(failure, "handled", False): return failure failure.handled = True if line_fun is None: def line_fun(line): logger.debug(line) if isinstance(failure, SshFailure): return failure if hasattr(failure.value, 'component'): line_fun('%s%s: %s' % (_determine_issued_command(failure), failure.value.component, failure.getErrorMessage())) else: line_fun(failure.getErrorMessage()) logger.debug(failure.getTraceback()) if include_stacktrace: for line in failure.getBriefTraceback().splitlines(): line_fun(line) return failure
def _catch_all(self, failure): log.error(failure.getBriefTraceback()) self.transport.write("error\r\n")