mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-21 06:19:38 +08:00
23 lines
493 B
PHP
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;
|
|
}
|
|
|
|
}
|
|
|
|
}
|