Customizing error grouping
Flare has a special grouping algorithm that groups similar error occurrences into errors to make understanding what's going on in your application easier.
While the default grouping algorithm works for 99% of the cases, there are some cases where you might want to customize the grouping.
This can be done on an exception class base, you can tell Flare to group all exceptions of a specific class together by setting the following in the flare.php
config file:
use Spatie\FlareClient\Enums\OverriddenGrouping;
// flare.php config file
'overridden_groupings' => [
SomeExceptionClass::class => OverriddenGrouping::ExeptionClass,
],
In this case every exception of the SomeExceptionClass
will be grouped together no matter what the message or stack trace is.
It is also possible to group exceptions of the same class together, but also take the message into account:
use Spatie\FlareClient\Enums\OverriddenGrouping;
// flare.php config file
'overridden_groupings' => [
SomeExceptionClass::class => OverriddenGrouping::ExceptionMessageAndClass,
],
Be careful when grouping by class and message, since every occurrence might have a slightly different message, this could lead to a lot of different errors.