-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from SRLabs-Forks/3.2
Update Exceptionhandler to match laravel/framework 5.2 Exception Handler
- Loading branch information
Showing
4 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php namespace Orchestra\Testbench; | ||
|
||
use Orchestra\Testbench\Contracts\TestCase as TestCaseContract; | ||
|
||
class ApplicationTestCase extends TestCase implements TestCaseContract | ||
{ | ||
/** | ||
* Resolve application HTTP exception handler. | ||
* | ||
* @param \Illuminate\Foundation\Application $app | ||
* | ||
* @return void | ||
*/ | ||
protected function resolveApplicationExceptionHandler($app) | ||
{ | ||
$app->singleton('Illuminate\Contracts\Debug\ExceptionHandler', 'Orchestra\Testbench\Exceptions\ApplicationHandler'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php namespace Orchestra\Testbench\Exceptions; | ||
|
||
use Exception; | ||
use Illuminate\Foundation\Testing\HttpException; | ||
use Illuminate\Auth\Access\AuthorizationException; | ||
use Illuminate\Validation\ValidationException; | ||
use Illuminate\Database\Eloquent\ModelNotFoundException; | ||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
|
||
class ApplicationHandler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that should not be reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = [ | ||
AuthorizationException::class, | ||
HttpException::class, | ||
ModelNotFoundException::class, | ||
ValidationException::class, | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. | ||
* | ||
* @param \Exception $e | ||
* @return void | ||
*/ | ||
public function report(Exception $e) | ||
{ | ||
parent::report($e); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Exception $e | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request, Exception $e) | ||
{ | ||
return parent::render($request, $e); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ public function render($request, Exception $e) | |
{ | ||
throw $e; | ||
} | ||
} | ||
} |