Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentsValidationException logged as critical #1193

Open
nicolas-codemate opened this issue Sep 3, 2024 · 0 comments
Open

ArgumentsValidationException logged as critical #1193

nicolas-codemate opened this issue Sep 3, 2024 · 0 comments

Comments

@nicolas-codemate
Copy link

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

public function onErrorFormatting(ErrorFormattingEvent $event): void
)

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 ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant