blessing-skin-server/app/Exceptions/RouterExceptionHandler.php
2016-07-21 22:01:57 +08:00

23 lines
493 B
PHP

<?php
namespace App\Exceptions;
use Pecee\Http\Request;
use Pecee\SimpleRouter\RouterEntry;
use Pecee\Handler\IExceptionHandler;
class RouterExceptionHandler implements IExceptionHandler
{
public function handleError(Request $request, RouterEntry $router = null, \Exception $error)
{
if ($error->getCode() === 404) {
\Http::abort(404, $error->getMessage(), ($_SERVER['REQUEST_METHOD'] == "POST"));
} else {
throw $error;
}
}
}