Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
84bd3ffc
Commit
84bd3ffc
authored
Mar 06, 2015
by
Dan Aldridge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add whoops support
only if the package is installed & app.debug is true
parent
864c4be4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
32 deletions
+53
-32
Handler.php
app/Exceptions/Handler.php
+53
-32
No files found.
app/Exceptions/Handler.php
View file @
84bd3ffc
...
...
@@ -3,40 +3,61 @@
use
Exception
;
use
Illuminate\Foundation\Exceptions\Handler
as
ExceptionHandler
;
class
Handler
extends
ExceptionHandler
{
class
Handler
extends
ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected
$dontReport
=
[
'Symfony\Component\HttpKernel\Exception\HttpException'
];
/**
* 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
)
{
return
parent
::
report
(
$e
);
}
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected
$dontReport
=
[
'Symfony\Component\HttpKernel\Exception\HttpException'
];
/**
* 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
)
{
if
(
config
(
'app.debug'
)
&&
class_exists
(
'\Whoops\Run'
))
{
return
$this
->
renderExceptionWithWhoops
(
$e
);
}
/**
* 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
)
{
return
parent
::
report
(
$e
);
}
return
parent
::
render
(
$request
,
$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
);
}
/**
* Render an exception using Whoops.
*
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
protected
function
renderExceptionWithWhoops
(
Exception
$e
)
{
$whoops
=
new
\Whoops\Run
;
$whoops
->
pushHandler
(
new
\Whoops\Handler\PrettyPageHandler
());
return
new
\Illuminate\Http\Response
(
$whoops
->
handleException
(
$e
),
$e
->
getStatusCode
(),
$e
->
getHeaders
()
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment