Skip to content

Commit 736dcd5

Browse files
author
Matt Stephens
committed
Handle exceptions in 5.2, Closes lucadegasperi/oauth2-server-laravel#641
1 parent 9b754d7 commit 736dcd5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Middleware/OAuthExceptionHandlerMiddleware.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ class OAuthExceptionHandlerMiddleware
3333
public function handle($request, Closure $next)
3434
{
3535
try {
36-
return $next($request);
36+
$response = $next($request);
37+
// Was an exception thrown? If so and available catch in our middleware
38+
if (isset($response->exception) && $response->exception) {
39+
throw $response->exception;
40+
}
41+
42+
return $response;
3743
} catch (OAuthException $e) {
3844
$data = [
3945
'error' => $e->errorType,

0 commit comments

Comments
 (0)