Skip to content

Commit

Permalink
Use BindingResolutionException to signal problem with container resol…
Browse files Browse the repository at this point in the history
…ution (#32349)

As part of static analysis sometimes abstracts get resolved which aren't
resolvable => that's totally fine but it would help to use a common
exception to signal this.

I figured BindingResolutionException would be the correct one. For example,
it's caught in cases like `\Illuminate\Foundation\Exceptions\Handler::whoopsHandler`
and IMHO this would also benefit from a streamlined exception.
  • Loading branch information
mfn authored Apr 13, 2020
1 parent e4d49ff commit 0eb3787
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Illuminate/Routing/RoutingServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Illuminate\Routing;

use Exception;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Contracts\Routing\ResponseFactory as ResponseFactoryContract;
use Illuminate\Contracts\Routing\UrlGenerator as UrlGeneratorContract;
use Illuminate\Contracts\View\Factory as ViewFactoryContract;
Expand Down Expand Up @@ -144,7 +144,7 @@ protected function registerPsrRequest()
return (new DiactorosFactory)->createRequest($app->make('request'));
}

throw new Exception('Unable to resolve PSR request. Please install symfony/psr-http-message-bridge and nyholm/psr7.');
throw new BindingResolutionException('Unable to resolve PSR request. Please install symfony/psr-http-message-bridge and nyholm/psr7.');
});
}

Expand All @@ -164,7 +164,7 @@ protected function registerPsrResponse()
return new ZendPsrResponse;
}

throw new Exception('Unable to resolve PSR response. Please install nyholm/psr7.');
throw new BindingResolutionException('Unable to resolve PSR response. Please install nyholm/psr7.');
});
}

Expand Down

0 comments on commit 0eb3787

Please sign in to comment.