Skip to content

Commit

Permalink
bug #693 Fix ExceptionListener: exception to log isn't necessarily a …
Browse files Browse the repository at this point in the history
…BaseException instance (ogizanagi)

This PR was merged into the master branch.

Discussion
----------

Fix ExceptionListener: exception to log isn't necessarily a BaseException instance

For instance [when an exception occurs when trying to render the exception template](https://github.com/javiereguiluz/EasyAdminBundle/blob/master/EventListener/ExceptionListener.php#L117-L120).

Commits
-------

549c7f8 Fix ExceptionListener: exception to log isn't necessarily a BaseException instance
  • Loading branch information
javiereguiluz committed Dec 27, 2015
2 parents 0d80068 + 549c7f8 commit a094064
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion EventListener/ExceptionListener.php
Expand Up @@ -72,8 +72,13 @@ public function showExceptionPageAction(FlattenException $exception)
*/
protected function logException(\Exception $exception, $message, $original = true)
{
if (!$exception instanceof BaseException) {
parent::logException($exception, $message, $original);

return;
}

if (null !== $this->logger) {
/** @var BaseException $exception */
if ($exception->getStatusCode() >= 500) {
$this->logger->critical($message, array('exception' => $exception));
} else {
Expand Down

0 comments on commit a094064

Please sign in to comment.