Prepare the report to be sent to IOpipe.

        :param error: An optional error to add to report.
        :param frame: A stack frame to add to report in the event of a timeout.
763366
def prepare(self, error=None, frame=None):
        
        if error:
            self.retain_error(error, frame)

        self.report["environment"]["host"]["boot_id"] = system.read_bootid()

        # convert labels to list for sending
        self.report["labels"] = list(self.labels)

        meminfo = system.read_meminfo()

        self.report.update(
            {
                "aws": self.extract_context_data(),
                "timestampEnd": int(time.time() * 1000),
            }
        )

        self.report["environment"]["os"].update(
            {
                "cpus": system.read_stat(),
                "freemem": meminfo["MemFree"],
                "hostname": system.read_hostname(),
                "totalmem": meminfo["MemTotal"],
                "usedmem": meminfo["MemTotal"] - meminfo["MemFree"],
            }
        )

        self.report["environment"]["os"]["linux"]["pid"] = {
            "self": {
                "stat": system.read_pid_stat("self"),
                "stat_start": self.stat_start,
                "status": system.read_pid_status("self"),
            }
        }

        self.report["disk"] = system.read_disk()

        self.report["duration"] = int((monotonic() - self.start_time) * 1e9)
1103275
def add_error(self, error):
        
        if is_non_string_iterable(error) and not isinstance(error, collections.Mapping):
            for value in error:
                self.add_error(value)
        else:
            self.append(error)
1148121
function ErrorWithCaller(caller) {
    Error.prepareStackTrace = function justStoreStackStace(error, frames) {
        error.__StackStace = frames;
        return '';
    };
    Error.captureStackTrace(this, caller);
    this.stack;  // jshint ignore:line
    delete Error.prepareStackTrace;
}
414997
function buildErrorObject(error) {
		var msg = error.message || 'Unknown error occurred';
		var errorName = errorTypes.includes(error.name) ? error.name : 'Error';
		var ErrConstructor = window[errorName] || Error;

		if (error.stack) {
			msg += '\n' + error.stack.replace(error.message, '');
		}
		return new ErrConstructor(msg);
	}
1361208
def addError(self, test, err, capt=None):
        
        if (err[0] == errors.BlockedTest or (
                err[0] == errors.SkipTest) or (
                err[0] == errors.DeprecatedTest)):
            print(err[1].__str__().split('''-------------------- >> '''
                                         '''begin captured logging'''
                                         ''' << --------------------''', 1)[0])
        else:
            # self.__log_all_options_if_none_specified(test)
            pass
        self.add_fails_or_errors(test)
1236209
def handle_g_error(error, return_value):
    
    error = error[0]
    assert bool(return_value) == (error == ffi.NULL)
    if error != ffi.NULL:
        if error.message != ffi.NULL:
            message = ('Pixbuf error: ' +
                       ffi.string(error.message).decode('utf8', 'replace'))
        else:  # pragma: no cover
            message = 'Pixbuf error'
        glib.g_error_free(error)
        raise ImageLoadingError(message)
541290
def add_error(e)
      @data[:error] = true

      if @data.key?(:ec)
        @data[:ec] = @data[:ec] + 1
      else
        @data[:ec] = 1
      end

      # If a valid exception has been passed in, log the information about it
      # In case of just logging an error for things such as HTTP client 5xx
      # responses, an exception/backtrace may not exist.
      if e
        if e.backtrace.is_a?(Array)
          add_stack(stack: e.backtrace)
        end

        if HTTP_SPANS.include?(@data[:n])
          set_tags(:http => { :error => "#{e.class}: #{e.message}" })
        else
          log(:error, Time.now, { :message => e.message, :parameters => e.class.to_s })
        end
        e.instance_variable_set(:@instana_logged, true)
      end
      self
    end
91559
public void queryError(HeadersAmp headers,
                         String to,
                         long qid,
                         Throwable exn)
    throws IOException
  {
    if (log.isLoggable(Level.FINEST)) {
      log.finest(this + " error " + exn
                + "\n  {to:" + to + "," + headers + "}");
      
    }
    
    if (log.isLoggable(Level.FINER)) {
      log.log(Level.FINER, exn.toString(), exn);
    }
    
    try {
      JsonWriterImpl jOut = _jOut;
      jOut.init();

      jOut.writeStartArray();
      jOut.write("error");

      writeHeaders(jOut, headers);

      jOut.write(to);
      jOut.write(qid);

      ErrorAmp error = ErrorAmp.create(exn);

      jOut.writeStartObject();
      jOut.writeKey("code");
      jOut.writeString(error.getCode().toString());
      
      jOut.writeKey("message");
      jOut.writeString(exn.getMessage());
      
      jOut.writeKey("class");
      jOut.writeString(exn.getClass().getName());
      
      jOut.writeEndObject();

      jOut.writeEndArray();

      jOut.close();
    } catch (Throwable e) {
      log.log(Level.WARNING, e.toString(), e);
      
      throw e;
    }
  }
864287
def error(self, message):
        
        if Settings.ErrorLogs:
            self._write_log("error", Settings.LogTime, message)
373051
function propagateError(error) {
    flow.pendingRejections_ += 1;
    return flow.timer.setTimeout(function() {
      flow.pendingRejections_ -= 1;
      flow.abortFrame_(error);
    }, 0);
  }
257062
def __advice_stack_frame_protection(self, frame):
        

        if frame is None:
            logger.debug(
                'currentframe() returned None; frame protection disabled')
            return

        f_back = frame.f_back
        while f_back:
            if f_back.f_code is self.handle.__code__:
                raise RuntimeError(
                    "indirect invocation of '%s' by 'handle' is forbidden" %
                    frame.f_code.co_name,
                )
            f_back = f_back.f_back
376724
def error(self, message, *args, **kwargs):
        
        kwargs.setdefault('extra', {}).setdefault('stack', True)
        return self.logger.error(message, *args, **kwargs)
918673
def _send_and_wait(self, **kwargs):
        
        frame_id = self.next_frame_id
        kwargs.update(dict(frame_id=frame_id))
        self._send(**kwargs)
        timeout = datetime.now() + const.RX_TIMEOUT
        while datetime.now() < timeout:
            try:
                frame = self._rx_frames.pop(frame_id)
                raise_if_error(frame)
                return frame
            except KeyError:
                sleep(0.1)
                continue
        _LOGGER.exception(
            "Did not receive response within configured timeout period.")
        raise exceptions.ZigBeeResponseTimeout()
239848
@Override
    public void error(VirtualConnection vc, TCPWriteRequestContext wsc, IOException ioe) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "error, vc=" + getVCHash());
        }
        // Nothing else needs to be done here. Report error up the chain.
        this.asyncBytesToWrite = 0L;
        this.callback.error(vc, this, ioe);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "error");
        }
    }
505635
def _write_frame(self, frame_out):
        
        self._connection.write_frame(0, frame_out)
        LOGGER.debug('Frame Sent: %s', frame_out.name)
522792
private void serveError(Status status, ErrorMessage.FailureReason reason, RequestHandler requestHandler) throws IOException {
    this.serveError(status, reason.getMessage(), requestHandler);
  }
58475
def _on_process_error(self, error):
        
        if self is None:
            return
        err = PROCESS_ERROR_STRING[error]
        self._formatter.append_message(err + '\r\n', output_format=OutputFormat.ErrorMessageFormat)