Commit 2b020478 authored by Igor Wiedler's avatar Igor Wiedler

rename BaseHttpException to HttpException

parent 628714a2
...@@ -310,7 +310,7 @@ You can also check for specific errors by using ``instanceof``, and handle ...@@ -310,7 +310,7 @@ You can also check for specific errors by using ``instanceof``, and handle
them differently:: them differently::
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BaseHttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
$app->error(function(\Exception $e) { $app->error(function(\Exception $e) {
...@@ -318,7 +318,7 @@ them differently:: ...@@ -318,7 +318,7 @@ them differently::
return new Response('The requested page could not be found.', 404); return new Response('The requested page could not be found.', 404);
} }
$code = ($e instanceof BaseHttpException) ? $e->getStatusCode() : 500; $code = ($e instanceof HttpException) ? $e->getStatusCode() : 500;
return new Response('We are sorry, but something went terribly wrong.', $code); return new Response('We are sorry, but something went terribly wrong.', $code);
}); });
......
...@@ -17,7 +17,7 @@ use Monolog\Handler\StreamHandler; ...@@ -17,7 +17,7 @@ use Monolog\Handler\StreamHandler;
use Silex\Application; use Silex\Application;
use Silex\ExtensionInterface; use Silex\ExtensionInterface;
use Symfony\Component\HttpKernel\Exception\BaseHttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
class MonologExtension implements ExtensionInterface class MonologExtension implements ExtensionInterface
{ {
...@@ -54,7 +54,7 @@ class MonologExtension implements ExtensionInterface ...@@ -54,7 +54,7 @@ class MonologExtension implements ExtensionInterface
}); });
$app->error(function(\Exception $e) use ($app) { $app->error(function(\Exception $e) use ($app) {
if ($e instanceof BaseHttpException) { if ($e instanceof HttpException) {
$app['monolog']->addWarning($e->getStatusCode().' '.$app['request']->getMethod().' '.$app['request']->getRequestUri()); $app['monolog']->addWarning($e->getStatusCode().' '.$app['request']->getMethod().' '.$app['request']->getRequestUri());
} else { } else {
$app['monolog']->addError($e->getMessage()); $app['monolog']->addError($e->getMessage());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment