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:
34
route.php
34
route.php
@@ -507,22 +507,32 @@ class route
|
|||||||
$ipClient = $_SERVER["REMOTE_ADDR"];
|
$ipClient = $_SERVER["REMOTE_ADDR"];
|
||||||
elseif (defined ("PHPUNIT"))
|
elseif (defined ("PHPUNIT"))
|
||||||
$ipClient = "CLI";
|
$ipClient = "CLI";
|
||||||
if ($this->ratelimiter !== null && $ipClient !== null &&
|
try
|
||||||
$this->ratelimiter->set ("error-$ipClient") === false)
|
|
||||||
{
|
{
|
||||||
$getCode = 406;
|
if ($this->ratelimiter !== null && $ipClient !== null &&
|
||||||
$message = dgettext("domframework", "Too much error requests");
|
$this->ratelimiter->set ("error-$ipClient") === false)
|
||||||
}
|
{
|
||||||
else
|
$getCode = 406;
|
||||||
{
|
$message = dgettext("domframework", "Too much error requests");
|
||||||
if ($e->getCode () === "" || $e->getCode () === 0)
|
}
|
||||||
$getCode = 500;
|
|
||||||
else
|
else
|
||||||
$getCode = $e->getCode ();
|
{
|
||||||
|
if ($e->getCode () === "" || $e->getCode () === 0)
|
||||||
|
$getCode = 500;
|
||||||
|
else
|
||||||
|
$getCode = $e->getCode ();
|
||||||
|
|
||||||
|
$message = $e->getMessage ();
|
||||||
|
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 ();
|
$message = $e->getMessage ();
|
||||||
if ($e->getCode () === 0)
|
$getCode = $e->getCode ();
|
||||||
$message .= "<p>The Exception code was 0 and converted to 500</p>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If an error class/method is defined, use it in place of the default
|
// If an error class/method is defined, use it in place of the default
|
||||||
|
|||||||
Reference in New Issue
Block a user