progress towards a working agent.
This commit is contained in:
parent
3c355e75ed
commit
8cba7e6a49
2 changed files with 20 additions and 1 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Benzine;
|
||||
|
||||
use Benzine\Exceptions\JsonErrorHandler;
|
||||
use Benzine\ORM\Connection\Databases;
|
||||
use Benzine\ORM\Laminator;
|
||||
use Benzine\Redis\Redis;
|
||||
|
|
@ -47,6 +48,7 @@ use Symfony\Component\Translation;
|
|||
use Tuupola\Middleware\ServerTimingMiddleware;
|
||||
use Twig;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
use Zeuxisoo\Whoops\Slim\WhoopsMiddleware;
|
||||
|
||||
class App
|
||||
{
|
||||
|
|
@ -106,7 +108,7 @@ class App
|
|||
if ($this->debugMode) {
|
||||
$this->app->addErrorMiddleware(true, true, true, $this->logger);
|
||||
}
|
||||
|
||||
|
||||
$this->debugBar['time']->startMeasure('interrogateTranslations', 'Time to interrogate translation files');
|
||||
$this->interrogateTranslations();
|
||||
$this->debugBar['time']->stopMeasure('interrogateTranslations');
|
||||
|
|
|
|||
17
src/Exceptions/JsonErrorHandler.php
Normal file
17
src/Exceptions/JsonErrorHandler.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Benzine\Exceptions;
|
||||
|
||||
use Slim\Interfaces\ErrorRendererInterface;
|
||||
use Throwable;
|
||||
|
||||
class JsonErrorHandler implements ErrorRendererInterface {
|
||||
public function __invoke(Throwable $exception, bool $displayErrorDetails): string
|
||||
{
|
||||
return json_encode([
|
||||
'error' => $exception->getMessage(),
|
||||
'where' => $exception->getFile() . ":" . $exception->getLine(),
|
||||
'code' => $exception->getCode(),
|
||||
], JSON_PRETTY_PRINT);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue