ArgumentsValidationException logged as critical
Opened this issue · 0 comments
nicolas-codemate commented
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Version/Branch | 1.5.0 |
Hi,
I use the ArgumentsValidationException
in mutations frequently to ensure my model adheres to business logic using Symfony asserts.
It's very handy because validation errors are properly displayed without much effort.
The problem is these kinds of exception are logged as critical (see
)In my opinion, it should behave exactly like UserError
(logged as Error).
What do you think ?
Proposals :
- Make ArgumentsValidationException extends UserError
- since ArgumentsValidationException implement ClientAware and marked as "ClientSafe"
// Overblog\GraphQLBundle\EventListener\ErrorLoggerListener
public function onErrorFormatting(ErrorFormattingEvent $event): void
{
// ...
if ($exception instanceof UserWarning) {
if ($exception->getPrevious()) {
$this->log($exception->getPrevious(), LogLevel::WARNING);
}
return;
}
if ($exception instanceof ClientSafe) {
if ($exception->getPrevious() && $exception->isClientSafe()) {
$this->log($exception->getPrevious());
}
return;
}
$this->log($exception, LogLevel::CRITICAL);
- something else ?