From 01ab8204591a031dd76eee500a45850a9ee374e6 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 22 Feb 2024 14:56:41 +0100 Subject: [PATCH] Fix error message formatting in handleError function --- bootstrap/helpers/shared.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index ed5819494..4a49f34a2 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -104,13 +104,13 @@ function handleError(?Throwable $error = null, ?Livewire\Component $livewire = n ray($error); if ($error instanceof TooManyRequestsException) { if (isset($livewire)) { - return $livewire->dispatch('error', "Error", "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds."); + return $livewire->dispatch('error', 'Too many requests. Please try again in {$error->secondsUntilAvailable} seconds.'); } return "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds."; } if ($error instanceof UniqueConstraintViolationException) { if (isset($livewire)) { - return $livewire->dispatch('error', "Error", "Duplicate entry found. Please use a different name."); + return $livewire->dispatch('error', 'Duplicate entry found. Please use a different name.'); } return "Duplicate entry found. Please use a different name."; } @@ -125,9 +125,6 @@ function handleError(?Throwable $error = null, ?Livewire\Component $livewire = n } if (isset($livewire)) { - if (str($message)->length() > 20) { - return $livewire->dispatch('error', 'Error', $message); - } return $livewire->dispatch('error', $message); } throw new Exception($message);