From 8cba7e6a4939243244f1390ec1d7cfbf364166e5 Mon Sep 17 00:00:00 2001 From: Matthew Baggett Date: Sat, 24 Jul 2021 11:08:59 +0200 Subject: [PATCH] progress towards a working agent. --- src/App.php | 4 +++- src/Exceptions/JsonErrorHandler.php | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/Exceptions/JsonErrorHandler.php diff --git a/src/App.php b/src/App.php index 21ec70f..2fecf29 100644 --- a/src/App.php +++ b/src/App.php @@ -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'); diff --git a/src/Exceptions/JsonErrorHandler.php b/src/Exceptions/JsonErrorHandler.php new file mode 100644 index 0000000..269f0bd --- /dev/null +++ b/src/Exceptions/JsonErrorHandler.php @@ -0,0 +1,17 @@ + $exception->getMessage(), + 'where' => $exception->getFile() . ":" . $exception->getLine(), + 'code' => $exception->getCode(), + ], JSON_PRETTY_PRINT); + } +} \ No newline at end of file