diff --git a/core/lib/Drupal/Core/Access/CustomAccessCheck.php b/core/lib/Drupal/Core/Access/CustomAccessCheck.php index e7a3b08..3893cb0 100644 --- a/core/lib/Drupal/Core/Access/CustomAccessCheck.php +++ b/core/lib/Drupal/Core/Access/CustomAccessCheck.php @@ -61,7 +61,12 @@ public function __construct(ControllerResolverInterface $controller_resolver, Ac * The access result. */ public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) { - $callable = $this->controllerResolver->getControllerFromDefinition($route->getRequirement('_custom_access')); + try { + $callable = $this->controllerResolver->getControllerFromDefinition($route->getRequirement('_custom_access')); + } catch (\InvalidArgumentException $e) { + throw new \BadMethodCallException(sprintf('The "%s" method is not callable as a _custom_access callback in route "%s"', $route->getRequirement('_custom_access'), $route->getPath())); + } + $arguments_resolver = $this->argumentsResolverFactory->getArgumentsResolver($route_match, $account); $arguments = $arguments_resolver->getArguments($callable);