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(); }