Merge pull request #578 from juliangut/master

unify middleware exception responses
This commit is contained in:
Alex Bilbie 2016-05-12 09:53:42 +01:00
commit 78dbb267ed
2 changed files with 4 additions and 6 deletions

View File

@ -46,9 +46,8 @@ class AuthorizationServerMiddleware
return $exception->generateHttpResponse($response); return $exception->generateHttpResponse($response);
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
} catch (\Exception $exception) { } catch (\Exception $exception) {
$response->getBody()->write($exception->getMessage()); return (new OAuthServerException($exception->getMessage(), 0, 'unknown_error', 500))
->generateHttpResponse($response);
return $response->withStatus(500);
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
} }

View File

@ -46,9 +46,8 @@ class ResourceServerMiddleware
return $exception->generateHttpResponse($response); return $exception->generateHttpResponse($response);
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
} catch (\Exception $exception) { } catch (\Exception $exception) {
$response->getBody()->write($exception->getMessage()); return (new OAuthServerException($exception->getMessage(), 0, 'unknown_error', 500))
->generateHttpResponse($response);
return $response->withStatus(500);
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
} }