function VersionNegotiator::throwBadRequestHttpException

Same name in other branches
  1. 9 core/modules/jsonapi/src/Revisions/VersionNegotiator.php \Drupal\jsonapi\Revisions\VersionNegotiator::throwBadRequestHttpException()
  2. 10 core/modules/jsonapi/src/Revisions/VersionNegotiator.php \Drupal\jsonapi\Revisions\VersionNegotiator::throwBadRequestHttpException()
  3. 11.x core/modules/jsonapi/src/Revisions/VersionNegotiator.php \Drupal\jsonapi\Revisions\VersionNegotiator::throwBadRequestHttpException()

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 core/modules/jsonapi/src/Revisions/VersionNegotiator.php
Gets a negotiated entity revision.

File

core/modules/jsonapi/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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.