route : if there is an error with the ratelimiter (directory not writeable...), averload the exception by the ratelimiter exception

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2699 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2016-04-19 13:04:54 +00:00
parent 5ad792d251
commit 18a641ca87

View File

@@ -507,6 +507,8 @@ class route
$ipClient = $_SERVER["REMOTE_ADDR"];
elseif (defined ("PHPUNIT"))
$ipClient = "CLI";
try
{
if ($this->ratelimiter !== null && $ipClient !== null &&
$this->ratelimiter->set ("error-$ipClient") === false)
{
@@ -524,6 +526,14 @@ class route
if ($e->getCode () === 0)
$message .= "<p>The Exception code was 0 and converted to 500</p>\n";
}
}
catch (Exception $e)
{
// If there is an error with the ratelimiter (file not writeable...),
// overload the Exception
$message = $e->getMessage ();
$getCode = $e->getCode ();
}
// If an error class/method is defined, use it in place of the default
// one.