Skip to content

Commit

Permalink
Laravel 5.2 support
Browse files Browse the repository at this point in the history
It no longer throws exceptions through middleware, but instead returns a
valid response with the exception set on it

see: lucadegasperi/oauth2-server-laravel#653
  • Loading branch information
danharper committed Jan 25, 2016
1 parent cc951ae commit 5cbf9cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Laravel/FormatExceptionsMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ public function handle($request, \Closure $next)
{
try
{
return $next($request);
$response = $next($request);

// Laravel 5.2 doesn't throw exceptions, it returns responses with it included
if (isset($response->exception) && $response->exception)
{
throw $response->exception;
}

return $response;
}
catch (\Exception $e)
{
Expand Down

2 comments on commit 5cbf9cf

@mstephens
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you found it useful @danharper

@danharper
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.