From ccfc4ef8eaaa215a8c902766ccaa3f2049b80d11 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 5 Nov 2024 10:58:56 +0100 Subject: [PATCH] fix(exception): send message for ForestException --- packages/Agent/src/Http/Traits/ErrorHandling.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/Agent/src/Http/Traits/ErrorHandling.php b/packages/Agent/src/Http/Traits/ErrorHandling.php index d676444e..2e56cd3d 100644 --- a/packages/Agent/src/Http/Traits/ErrorHandling.php +++ b/packages/Agent/src/Http/Traits/ErrorHandling.php @@ -3,6 +3,7 @@ namespace ForestAdmin\AgentPHP\Agent\Http\Traits; use ForestAdmin\AgentPHP\Agent\Builder\AgentFactory; +use ForestAdmin\AgentPHP\DatasourceToolkit\Exceptions\ForestException; use ReflectionClass; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; @@ -21,7 +22,9 @@ public function getErrorStatus(Throwable $error): int public function getErrorMessage(Throwable $error): string { - if ($error instanceof HttpException || is_subclass_of($error, HttpException::class)) { + if ($error instanceof HttpException || + is_subclass_of($error, HttpException::class) || + $error instanceof ForestException) { return $error->getMessage(); }