Skip to content

Commit 271ebdb

Browse files
committed
muted excessive error logging through a listener
1 parent 4b51f76 commit 271ebdb

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/**
4+
* @copyright Copyright (C) Ibexa AS. All rights reserved.
5+
* @license For full copyright and license information view LICENSE file distributed with this source code.
6+
*/
7+
namespace Ibexa\GraphQL\EventListener;
8+
9+
use Ibexa\GraphQL\DataLoader\Exception\ArgumentsException;
10+
use Overblog\GraphQLBundle\Event\ErrorFormattingEvent;
11+
use Overblog\GraphQLBundle\Event\Events;
12+
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
13+
14+
/**
15+
* @internal
16+
*/
17+
final class ArgumentsExceptionListener implements EventSubscriberInterface
18+
{
19+
public static function getSubscribedEvents(): array
20+
{
21+
return [
22+
Events::ERROR_FORMATTING => ['onErrorFormatting', 50],
23+
];
24+
}
25+
26+
public function onErrorFormatting(ErrorFormattingEvent $event): void
27+
{
28+
if ($event->getError()->getPrevious() instanceof ArgumentsException) {
29+
$event->stopPropagation();
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)