Updated exception reference

This commit is contained in:
Alex Bilbie 2015-11-16 09:27:49 +00:00
parent 32b451aa21
commit c0bdd22154

View File

@ -1,6 +1,6 @@
<?php
use League\OAuth2\Server\Exception\OAuthException;
use League\OAuth2\Server\Exception\OAuthServerException;
use League\OAuth2\Server\Grant\ClientCredentialsGrant;
use League\OAuth2\Server\Server;
@ -27,14 +27,13 @@ $server->enableGrantType(new ClientCredentialsGrant($clientRepository, $scopeRep
// App
$app = new App([Server::class => $server]);
unset($app->getContainer()['errorHandler']);
$app->post('/access_token', function (Request $request, Response $response) {
/** @var Server $server */
$server = $this->getContainer()->get(Server::class);
try {
return $server->respondToRequest($request);
} catch (OAuthException $e) {
} catch (OAuthServerException $e) {
return $e->generateHttpResponse();
} catch (\Exception $e) {
return $response->withStatus(500)->write($e->getMessage());