Skip to content

Commit 15cc63c

Browse files
committed
Catch throwable instead of UrlGenerationException, so we can also catch RouteNotFoundException
1 parent 3d16625 commit 15cc63c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/TranslateRoute.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
use Codedor\TranslatableRoutes\Facades\TranslateRouteParts;
99
use Illuminate\Database\Eloquent\Collection;
1010
use Illuminate\Database\Eloquent\Model;
11-
use Illuminate\Routing\Exceptions\UrlGenerationException;
1211
use Illuminate\Support\Str;
12+
use Throwable;
1313

1414
class TranslateRoute
1515
{
@@ -30,7 +30,7 @@ public static function forName(string $routeName, ?string $locale = null, array|
3030
"{$localeObject->routePrefix()}.{$routeName}",
3131
self::translateParameters($parameters, $localeObject)
3232
);
33-
} catch (UrlGenerationException $th) {
33+
} catch (Throwable $th) {
3434
// We don't want to report the same error multiple times
3535
if (! in_array($th->getMessage(), self::$errorMessages)) {
3636
self::$errorMessages[] = $th->getMessage();

0 commit comments

Comments
 (0)