Mark an error.

@param rpcCode {String} Code representing the failure.
@param cause {Error} The cause of the error. It is available as `cause`
field on the outer error.

This is used to keep the argument of channels' `'error'` event errors.
765595
function toRpcError(rpcCode, cause) {
  var err = toError(rpcCode.toLowerCase().replace(/_/g, ' '), cause);
  err.rpcCode = (cause && cause.rpcCode) ? cause.rpcCode : rpcCode;
  return err;
}
883274
protected void onClose(final int closeCode, final String reason) {
        postCloseEvent(WebSocketCloseCode.getByCodeOrElse(closeCode, WebSocketCloseCode.ABNORMAL), reason);
    }
1089148
public static void sendError( String messageKey, Throwable cause, ServletRequest request,
                                  HttpServletResponse response, Object[] messageArgs )
            throws IOException
    {
        // TODO: the following null check will be unnecessary once the deprecated
        // FlowController.sendError(String, HttpServletResponse) is removed.
        boolean avoidDirectResponseOutput = request != null ? avoidDirectResponseOutput( request ) : false;
        sendError( messageKey, messageArgs, request, response, cause, avoidDirectResponseOutput );
    }
622995
void _emitJcc(INST_CODE code, Label label, final HINT hint) {
        if (hint == HINT.HINT_NONE) {
            emitX86(code, label);
        } else {
            emitX86(code, label, Immediate.imm(hint.value()));
        }
    }
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");
        }
    }
487207
function InternalServerError(message, cause) {
    InternalServerError.super_.call(this, message, StatusCode.INTERNAL_SERVER_ERROR, cause);
}
589549
public static void setError(final Span span, final Exception cause) {
        span.setTag(Tags.ERROR.getKey(), true).log(System.currentTimeMillis(), getReason(cause));
    }
305587
public void addWarning(int code, Object... args) {
		//@formatter:off
		warnings.add(new ParseWarning.Builder(this)
			.message(code, args)
		.build());
		//@formatter:on
	}
567926
@Override
	public void subscribeFailed(int responseCode,
			XDMClientChildSbbLocalObject child, String notifier) {
		tracer.severe("Failed to subscribe, response = " + responseCode);
	}
1032591
function DECLARE_ERROR_CODE(base, localCode, message) {
        if ("string" === typeof base) {
            base = CDP.RESULT_CODE_BASE[base];
        }
        return declareResultCode(base, localCode, message, false);
    }
95921
public void onFailure (Throwable cause)
    {
        _panel.clear();
        _panel.add(Widgets.newLabel(formatError(cause), "errorLabel"));
        Console.log("Service request failed", cause);
    }
135225
function (error, type) {

      // don't send a second response
      if (responseHasBeenSent) {
        console.warn('JSON-RPC2 response has already been sent.')
        return
      }
      // notifications should not send error responses (JSON-RPC2 specs)
      if (!isMethodCall) {
        var message = (error && error.toString) ? error.toString() : undefined
        logNotificationResponseWarning(message, requestMessage)
        callback()
        return
      }

      // internals
      var errorObject

      if (error instanceof Error) {
        // serious application error
        console.warn(
          'Error in JSON-RPC2 method ' + methodName + ': ' + error.toString() + '\n'
          + error.stack
        )
        // not sending detailed error info to not expose details about server code
        errorObject = {
          code: errorCodes['APPLICATION_ERROR'],
          message: errorMessages['APPLICATION_ERROR'] + ' (Check server logs for details)'
        }

      } else if (typeof error === 'string') {
        // error message
        errorObject = {
          code: errorCodes[type] || errorCodes['INVALID_REQUEST'],
          message: error
        }

      } else if (typeof error === 'object') {
        if (error.message) {
          // error object
          errorObject = error
          if (error.code === undefined) {
            error.code = errorCodes['INVALID_REQUEST']
          }

        } else {
          // error data
          errorObject = {
            code: errorCodes[type] || errorCodes['INVALID_REQUEST'],
            message: errorMessages[type] || errorMessages['INVALID_REQUEST'],
            data: error
          }
        }

      } else {
        if (error !== undefined) {
          console.warn('Error parameter must be a string (error message) or object (error data)')
        }
        // fallback
        errorObject = errorObjects['INVALID_REQUEST']

      }

      var rpcMessage = {
        jsonrpc: '2.0',
        error: errorObject,
        id: id
      }

      callback(rpcMessage)
      responseHasBeenSent = true

    }
848961
public void removeAndFailAll(Throwable cause) {
        assert ctx.executor().inEventLoop();
        if (cause == null) {
            throw new NullPointerException("cause");
        }
        // It is possible for some of the failed promises to trigger more writes. The new writes
        // will "revive" the queue, so we need to clean them up until the queue is empty.
        for (PendingWrite write = head; write != null; write = head) {
            head = tail = null;
            size = 0;
            bytes = 0;
            while (write != null) {
                PendingWrite next = write.next;
                ReferenceCountUtil.safeRelease(write.msg);
                ChannelPromise promise = write.promise;
                recycle(write, false);
                safeFail(promise, cause);
                write = next;
            }
        }
        assertEmpty();
    }
863947
function SigningError(cause) {
    this.code = 'SigningError';
    assert.optionalObject(cause);
    var msg = 'error signing request';
    var args = (cause ? [cause, msg] : [msg]);
    WError.apply(this, args);
}
1056481
public MAPErrorMessage createMessageFromErrorCode(Long errorCode) {
        long ec = (long) errorCode;
        switch ((int) ec) {
            case MAPErrorCode.unexpectedDataValue:
            case MAPErrorCode.dataMissing:
            case MAPErrorCode.unidentifiedSubscriber:
            case MAPErrorCode.illegalSubscriber:
            case MAPErrorCode.illegalEquipment:
            case MAPErrorCode.teleserviceNotProvisioned:
            case MAPErrorCode.messageWaitingListFull:
            case MAPErrorCode.unauthorizedRequestingNetwork:
            case MAPErrorCode.resourceLimitation:
            case MAPErrorCode.unknownOrUnreachableLCSClient:
            case MAPErrorCode.incompatibleTerminal:
            case MAPErrorCode.noRoamingNumberAvailable:
            case MAPErrorCode.noSubscriberReply:
            case MAPErrorCode.forwardingFailed:
            case MAPErrorCode.orNotAllowed:
            case MAPErrorCode.forwardingViolation:
            case MAPErrorCode.numberChanged:
            case MAPErrorCode.unknownMSC:
            case MAPErrorCode.unknownEquipment:
            case MAPErrorCode.bearerServiceNotProvisioned:
            case MAPErrorCode.mmEventNotSupported:
            case MAPErrorCode.illegalSSOperation:
            case MAPErrorCode.ssNotAvailable:
            case MAPErrorCode.ssSubscriptionViolation:
            case MAPErrorCode.unknownAlphabet:
            case MAPErrorCode.ussdBusy:
            case MAPErrorCode.negativePWCheck:
            case MAPErrorCode.numberOfPWAttemptsViolation:
            case MAPErrorCode.shortTermDenial:
            case MAPErrorCode.longTermDenial:
                return new MAPErrorMessageExtensionContainerImpl(errorCode);

            case MAPErrorCode.smDeliveryFailure:
                return new MAPErrorMessageSMDeliveryFailureImpl();

            case MAPErrorCode.absentSubscriberSM:
                return new MAPErrorMessageAbsentSubscriberSMImpl();

            case MAPErrorCode.systemFailure:
                return new MAPErrorMessageSystemFailureImpl();

            case MAPErrorCode.callBarred:
                return new MAPErrorMessageCallBarredImpl();

            case MAPErrorCode.facilityNotSupported:
                return new MAPErrorMessageFacilityNotSupImpl();

            case MAPErrorCode.unknownSubscriber:
                return new MAPErrorMessageUnknownSubscriberImpl();

            case MAPErrorCode.subscriberBusyForMTSMS:
                return new MAPErrorMessageSubscriberBusyForMtSmsImpl();

            case MAPErrorCode.absentSubscriber:
                return new MAPErrorMessageAbsentSubscriberImpl();

            case MAPErrorCode.unauthorizedLCSClient:
                return new MAPErrorMessageUnauthorizedLCSClientImpl();

            case MAPErrorCode.positionMethodFailure:
                return new MAPErrorMessagePositionMethodFailureImpl();

            case MAPErrorCode.busySubscriber:
                return new MAPErrorMessageBusySubscriberImpl();

            case MAPErrorCode.cugReject:
                return new MAPErrorMessageCUGRejectImpl();

            case MAPErrorCode.roamingNotAllowed:
                return new MAPErrorMessageRoamingNotAllowedImpl();

            case MAPErrorCode.ssErrorStatus:
                return new MAPErrorMessageSsErrorStatusImpl();

            case MAPErrorCode.ssIncompatibility:
                return new MAPErrorMessageSsIncompatibilityImpl();

            case MAPErrorCode.pwRegistrationFailure:
                return new MAPErrorMessagePwRegistrationFailureImpl();

            default:
                return new MAPErrorMessageParameterlessImpl(errorCode);
        }

    }
455961
public void error(DiagnosticFlag flag, DiagnosticPosition pos, Error errorKey) {
        report(diags.error(flag, source, pos, errorKey));
    }
161746
def receiveError(self, reasonCode, description):
        
        error = disconnectErrors.get(reasonCode, DisconnectError)
        self.connectionClosed(error(reasonCode, description))
        SSHClientTransport.receiveError(self, reasonCode, description)