Skip to content

Commit

Permalink
Requires the Exception to be instance of HttpExceptionInterface to ch…
Browse files Browse the repository at this point in the history
…eck for getResponse() method
  • Loading branch information
artstorm committed Jun 26, 2015
1 parent dd31da5 commit 0095401
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion api/app/Exceptions/ValidationException.php
Expand Up @@ -2,8 +2,9 @@

use Illuminate\Support\MessageBag;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;

class ValidationException extends HttpException
class ValidationException extends HttpException implements HttpExceptionInterface
{

/**
Expand Down
8 changes: 4 additions & 4 deletions api/app/Http/Controllers/BaseController.php
Expand Up @@ -207,14 +207,14 @@ public static function renderException($request, \Exception $e, $debug = false){
'message' => $message,
];

if (method_exists($e, 'getResponse')) {
$response = $e->getResponse();
}

$statusCode = 500;

if ($e instanceof HttpExceptionInterface){
$statusCode = $e->getStatusCode();

if (method_exists($e, 'getResponse')) {
$response = $e->getResponse();
}
}

if ($debug){
Expand Down

0 comments on commit 0095401

Please sign in to comment.