Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- <?php
- declare(strict_types = 1);
- namespace Controllers;
- use Loger\Log;
- use Psr\Http\Message\ServerRequestInterface;
- use Slim\Exception\HttpNotFoundException;
- use Throwable;
- use Core\Main;
- class ErrorHandler
- {
- function __invoke(ServerRequestInterface $request, Throwable $exception, bool $displayErrorDetails, bool $logErrors, bool $logErrorDetails)
- {
- Log::addInfo('work!');
- $payload = ['error' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine()];
- $response = Main::$app->getResponseFactory()->createResponse();
- $response->getBody()->write(
- json_encode($payload, JSON_UNESCAPED_UNICODE)
- );
- return $response;
- }
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.