Skip to content

Commit

Permalink
Add overriding grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Dec 2, 2024
1 parent e05a162 commit 3c5294d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"ext-json": "*",
"ext-mbstring": "*",
"illuminate/support": "^11.0",
"spatie/flare-client-php": "^1.7",
"spatie/flare-client-php": "^1.10",
"symfony/console": "^7.0",
"symfony/var-dumper": "^7.0",
"spatie/laravel-error-share": "^1.0",
Expand Down
17 changes: 17 additions & 0 deletions config/flare.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,21 @@
*/

'enable_share_button' => true,

/*
|--------------------------------------------------------------------------
| Override grouping
|--------------------------------------------------------------------------
|
| Flare will try to group errors and exceptions as best as possible, that
| being said, sometimes you might want to override the grouping. You can
| do this by adding exception classes to this array which should always
| be grouped by exception class, exception message or exception class
| and message.
|
*/

'overridden_groupings' => [
// Illuminate\Http\Client\ConnectionException::class => Spatie\FlareClient\Enums\OverriddenGrouping::ExceptionMessageAndClass,
],
];
8 changes: 7 additions & 1 deletion src/FlareServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function publishConfigs(): void
protected function registerFlare(): void
{
$this->app->singleton(Flare::class, function () {
return Flare::make()
$flare = Flare::make()
->setApiToken(config('flare.key') ?? '')
->setBaseUrl(config('flare.base_url', 'https://flareapp.io/api'))
->applicationPath(base_path())
Expand All @@ -93,6 +93,12 @@ protected function registerFlare(): void
config('flare.with_stack_frame_arguments', true),
config('flare.force_stack_frame_arguments_ini_setting', true)
);

foreach (config('flare.overridden_groupings') as $exceptionClass => $grouping) {
$flare->overrideGrouping($exceptionClass, $grouping);
}

return $flare;
});

$this->app->singleton(SentReports::class);
Expand Down

0 comments on commit 3c5294d

Please sign in to comment.