Skip to content

Commit

Permalink
fix(exception): send message for ForestException
Browse files Browse the repository at this point in the history
  • Loading branch information
matthv committed Nov 5, 2024
1 parent e5308d6 commit ccfc4ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/Agent/src/Http/Traits/ErrorHandling.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}

Expand Down

0 comments on commit ccfc4ef

Please sign in to comment.