Create a status.

@param severity the severity level, see {@link IStatus}.
@param code the code of the error.
@param cause the cause of the problem.
@return the status.
10979
public IStatus createStatus(int severity, int code, Throwable cause) {
		return createStatus(severity, code, null, cause);
	}
455871
public void setSeverity(Severity severity) {
	
        if ((severity.getOrdinal() < SEVERITY_INFO.getOrdinal()) || 
	    (severity.getOrdinal() > SEVERITY_FATAL.getOrdinal())) {
            throw new IllegalArgumentException(String.valueOf(severity));
        }
        this.severity = severity;
	
    }
269873
public int count(Severity severity) {
		int result = 0;
		if (severity == null) {
			return result;
		}
		for (ValidationMessage<Origin> message : messages) {
			if (severity.equals(message.getSeverity())) {
				result++;
			}
		}
		return result;
	}
387697
public static ResponseDTO build(int status, Throwable error) {
        ResponseDTO result = new ResponseDTO();
        result.setStatus(status);
        result.setError(error);
        return result;
    }
286453
public function putStatus(string $code, Status $status = null, string $explanation = null): Assert
    {
        return $this->put($code, null, $status, $explanation);
    }
476312
public static Action status(final HttpStatus status) {
        return new Action(input -> {
            input.setStatus(status);
            return input;
        });
    }
431815
public static HttpStatusException of(int statusCode) {
        if (statusCode < 0 || statusCode >= 1000) {
            final HttpStatus status = HttpStatus.valueOf(statusCode);
            if (Flags.verboseExceptions()) {
                return new HttpStatusException(status);
            } else {
                return new HttpStatusException(status, false);
            }
        } else {
            return EXCEPTIONS[statusCode];
        }
    }
465399
public void setStatus(int code,String message)
    {
        setStatus(code);
        Integer code_integer=TypeUtil.newInteger(code);
        if (message == null)
        {
            message = (String)__statusMsg.get(code_integer);
            if (message==null)
                message=""+code;
            setReason(message);
        }
        else
            setReason(UrlEncoded.encodeString(message));
    }
836584
protected int statusCodeForException(@Nonnull Throwable exception) {
        if (exception instanceof PApplicationException) {
            PApplicationException e = (PApplicationException) exception;
            if (e.getId() == PApplicationExceptionType.INVALID_PROTOCOL ||
                e.getId() == PApplicationExceptionType.PROTOCOL_ERROR ||
                e.getId() == PApplicationExceptionType.BAD_SEQUENCE_ID ||
                e.getId() == PApplicationExceptionType.INVALID_MESSAGE_TYPE) {
                return HttpServletResponse.SC_BAD_REQUEST;
            }
            if (e.getId() == PApplicationExceptionType.UNKNOWN_METHOD) {
                return HttpServletResponse.SC_NOT_FOUND;
            }
        }
        return HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
    }
1287169
@Override
    public void setStatusCode(int code) {
        StatusCodes val = null;
        try {
            val = StatusCodes.getByOrdinal(code);
        } catch (IndexOutOfBoundsException e) {
            // no FFDC required
            // nothing to do, just make the undefined value below
        }

        // this could be null because the ordinal lookup returned an empty
        // status code, or because it was out of bounds
        if (null == val) {
            val = StatusCodes.makeUndefinedValue(code);
        }
        setStatusCode(val);
    }
1243685
protected function status($status, $code)
	{
		$data = $this->getStatusData($status);
		return $this->jsonResponse($data, $code);
	}
1174273
public static <T> GenericResponseBuilder<T> status(int status, T entity) {
    return genericResponseBuilderFactory.create(status, entity);
  }
224187
private static Severity severityFor(Level level) {
    switch (level.toInt()) {
        // TRACE
      case 5000:
        return Severity.DEBUG;
        // DEBUG
      case 10000:
        return Severity.DEBUG;
        // INFO
      case 20000:
        return Severity.INFO;
        // WARNING
      case 30000:
        return Severity.WARNING;
        // ERROR
      case 40000:
        return Severity.ERROR;
      default:
        return Severity.DEFAULT;
    }
  }
489478
public void setStatus(int statusCode, String reasonPhrase) {
		try {
			final Response response = getResponse();
			response.setStatusCode(statusCode);
			response.setReasonPhrase(reasonPhrase);
		} catch (ParseException e) {
			throw new IllegalArgumentException(e);
		}

	}
1275787
public static SpdySessionStatus valueOf(int code) {
        switch (code) {
        case 0:
            return OK;
        case 1:
            return PROTOCOL_ERROR;
        case 2:
            return INTERNAL_ERROR;
        }

        return new SpdySessionStatus(code, "UNKNOWN (" + code + ')');
    }
1324386
def apply_status_code(status:)
      raise EntityClosedError if closed?
      case status.to_i
      when 429
        @throttle = true
        @error = true
        @fault = false
      when 400..499
        @error = true
        @throttle = false
        @fault = false
      when 500..599
        @fault = true
        @error = false
        @throttle = false
      end

      @http_response ||= {}
      @http_response[:status] = status.to_i
    end
264550
def add_status_code(code):
    
    def class_decorator(cls):
        """内部装饰函数,用于将异常类注册到对应的状态码.

        Parameters:
            cls (Callable): - 要注册的异常类
        Return:
            (Callable): - 注册的异常类

        """
        cls.status_code = code
        _mprpc_exceptions[code] = cls
        return cls

    return class_decorator