You are here

protected static function VersionNegotiator::throwBadRequestHttpException in JSON:API 8.2

Throws a cacheable error exception.

Parameters

string $resource_version_identifier: The user input for the revision negotiation.

Throws

\Drupal\Core\Http\Exception\CacheableBadRequestHttpException

1 call to VersionNegotiator::throwBadRequestHttpException()
VersionNegotiator::getRevision in src/Revisions/VersionNegotiator.php
Gets a negotiated entity revision.

File

src/Revisions/VersionNegotiator.php, line 106

Class

VersionNegotiator
Provides a version negotiator manager.

Namespace

Drupal\jsonapi\Revisions

Code

protected static function throwBadRequestHttpException($resource_version_identifier) {
  $cacheability = (new CacheableMetadata())
    ->addCacheContexts([
    'url.query_args:' . ResourceVersionRouteEnhancer::RESOURCE_VERSION_QUERY_PARAMETER,
  ]);
  $message = sprintf('An invalid resource version identifier, `%s`, was provided.', $resource_version_identifier);
  throw new CacheableBadRequestHttpException($cacheability, $message);
}