Returns a new {@link HttpStatusException} instance with the specified HTTP status code.
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];
        }
    }
82044
public static function rpcCodeFromHttpStatusCode($httpStatusCode)
    {
        if (array_key_exists($httpStatusCode, self::$httpStatusCodeToRpcCodeMap)) {
            return self::$httpStatusCodeToRpcCodeMap[$httpStatusCode];
        }
        return ApiStatus::UNRECOGNIZED_CODE;
    }
68461
@SuppressWarnings({"ThrowableInstanceNeverThrown"})
    public static HttpResponseException error(int code, String errorMessage) {
        return error(code,new Exception(errorMessage));
    }
96806
public void addStatusMapping(String statusCode, Integer httpStatus) {
		Assert.notNull(statusCode, "StatusCode must not be null");
		Assert.notNull(httpStatus, "HttpStatus must not be null");
		this.statusMapping.put(statusCode, httpStatus);
	}
1346071
public static AlluxioStatusException from(Status status) {
    Preconditions.checkNotNull(status, "status");
    Preconditions.checkArgument(status != Status.OK, "OK is not an error status");
    String message = status.getDescription();
    Throwable cause = status.getCause();
    switch (status.getCode()) {
      case CANCELLED:
        return new CancelledException(message, cause);
      case INVALID_ARGUMENT:
        return new InvalidArgumentException(message, cause);
      case DEADLINE_EXCEEDED:
        return new DeadlineExceededException(message, cause);
      case NOT_FOUND:
        return new NotFoundException(message, cause);
      case ALREADY_EXISTS:
        return new AlreadyExistsException(message, cause);
      case PERMISSION_DENIED:
        return new PermissionDeniedException(message, cause);
      case UNAUTHENTICATED:
        return new UnauthenticatedException(message, cause);
      case RESOURCE_EXHAUSTED:
        return new ResourceExhaustedException(message, cause);
      case FAILED_PRECONDITION:
        return new FailedPreconditionException(message, cause);
      case ABORTED:
        return new AbortedException(message, cause);
      case OUT_OF_RANGE:
        return new OutOfRangeException(message, cause);
      case UNIMPLEMENTED:
        return new UnimplementedException(message, cause);
      case INTERNAL:
        return new InternalException(message, cause);
      case UNAVAILABLE:
        return new UnavailableException(message, cause);
      case DATA_LOSS:
        return new DataLossException(message, cause);
      default:
        return new UnknownException(message, cause);
    }
  }
666267
public Status withCause(Throwable cause) {
    if (Objects.equal(this.cause, cause)) {
      return this;
    }
    return new Status(this.code, this.description, cause);
  }
632510
@VisibleForTesting
  static Status toGrpcStatus(ErrorCode code) {
    Status status = ERROR_CODE_TO_STATUS.get(code);
    return status != null ? status : Status.UNKNOWN.withDescription(
        "Unknown http2 error code: " + code.httpCode);
  }
1369284
@Override
  public void onException(Throwable failureCause) {
    Preconditions.checkNotNull(failureCause, "failureCause");
    Status status = Status.UNAVAILABLE.withCause(failureCause);
    startGoAway(0, ErrorCode.INTERNAL_ERROR, status);
  }
531547
public IStatus createStatus(int severity, int code, String message) {
		return createStatus(severity, code, message, null);
	}
54341
public HttpSessionActivity getHttpSessionActivity(HttpSession httpSession)
			throws NullPointerException, IllegalArgumentException, IllegalStateException,
			ActivityAlreadyExistsException, StartActivityException,
			SLEEException {
		if (httpSession == null) {
			throw new NullPointerException("null http session");
		}
		if (!(httpSession instanceof HttpSessionWrapper)) {
			throw new IllegalArgumentException();
		}
		final HttpSessionWrapper httpSessionWrapper = (HttpSessionWrapper) httpSession;
		final HttpSessionActivityImpl activity = new HttpSessionActivityImpl(httpSessionWrapper);
		if (httpSessionWrapper.getResourceEntryPoint() == null) {
			ra.getSleeEndpoint().startActivitySuspended(activity,activity);
			httpSessionWrapper.setResourceEntryPoint(ra.getName());
		}
		return activity;
	}
1022159
public static Status createStatus(String rawJSON) throws TwitterException {
        try {
            return new StatusJSONImpl(new JSONObject(rawJSON));
        } catch (JSONException e) {
            throw new TwitterException(e);
        }
    }
969673
public function setHttpStatusCode(int $httpStatusCode): self
    {
        if (!array_key_exists($httpStatusCode, Response::$statusTexts)) {
            $this->internalServerError('Invalid status code in ' . __METHOD__, Response::$statusTexts);
        }
        $this->httpStatusCode = $httpStatusCode;
        return $this;
    }
689806
public static HttpResponse newResponse(RequestContext ctx, HttpStatus status, String message) {
        requireNonNull(ctx, "ctx");
        requireNonNull(status, "status");
        requireNonNull(message, "message");
        return newResponse0(ctx, status, null, message);
    }
609269
public static PackageManagerHttpActionException forIOException(String url, IOException ex) {
    String message = "HTTP call to " + url + " failed: "
        + StringUtils.defaultString(ex.getMessage(), ex.getClass().getSimpleName());
    if (ex instanceof SocketTimeoutException) {
      message += " (consider to increase the socket timeout using -Dvault.httpSocketTimeoutSec)";
    }
    return new PackageManagerHttpActionException(message, ex);
  }
1093412
protected function createApiClientException(
        $statusCode,
        $message,
        $requestContents,
        $responseContents
    ): ApiClientException {
        return ExceptionFactory::create($statusCode, $message, $requestContents, $responseContents);
    }
141907
public HTTPResponse handleError(HTTPResponse response) throws HTTPException {
        if (response.statusCode < 200 || response.statusCode >= 300) {
            throw new HTTPException(response.statusCode, response.reason);
        }
        return response;
    }
1168460
public SoapServerResponseActionBuilder status(HttpStatus status) {
        soapMessage.header(SoapMessageHeaders.HTTP_STATUS_CODE, status.value());
        return this;
    }