mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 04:04:45 +02:00
25 lines
606 B
PHP
25 lines
606 B
PHP
<?php
|
|
|
|
namespace App\Services\Exceptions;
|
|
|
|
use Exception;
|
|
use Filament\Notifications\Notification;
|
|
|
|
class FilamentExceptionHandler
|
|
{
|
|
public function handle(Exception $exception, Callable $stopPropagation): void
|
|
{
|
|
Notification::make()
|
|
->title($exception->title ?? null)
|
|
->body($exception->body ?? $exception->getMessage())
|
|
->color($exception->color ?? 'danger')
|
|
->icon($exception->icon ?? 'tabler-x')
|
|
->danger()
|
|
->send();
|
|
|
|
if ($this->stopPropagation ?? true) {
|
|
$stopPropagation();
|
|
}
|
|
}
|
|
}
|