From 3c889dd6872d65d3095e4e95f65c2527a3186a1c Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Wed, 11 Sep 2024 17:35:11 +0400 Subject: [PATCH] Input Manager: print scope names if ServerRequestInterface is not set in the current scope --- src/Http/src/Request/InputManager.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Http/src/Request/InputManager.php b/src/Http/src/Request/InputManager.php index 4efda02da..54da23f1b 100644 --- a/src/Http/src/Request/InputManager.php +++ b/src/Http/src/Request/InputManager.php @@ -13,6 +13,7 @@ use Spiral\Core\Attribute\Scope; use Spiral\Core\Attribute\Singleton; use Spiral\Core\Exception\ScopeException; +use Spiral\Core\Internal\Introspector; use Spiral\Http\Config\HttpConfig; use Spiral\Http\Exception\InputException; use Spiral\Http\Header\AcceptHeader; @@ -192,10 +193,11 @@ public function request(): Request try { $request = $this->container->get(Request::class); } catch (ContainerExceptionInterface $e) { + $scope = implode('.', \array_reverse(Introspector::scopeNames($this->container))); throw new ScopeException( - 'Unable to get `ServerRequestInterface` in active container scope', + "Unable to get `ServerRequestInterface` in the `$scope` container scope", $e->getCode(), - $e + $e, ); }