Fix custom error messages (#13898)

* Fix custom error messages
Laravel apparently wraps things in ViewException now and so does ignition.  Ideally, we would plug in the same way as ignition, but just fix the old code for now.

* Don't break the ViewException handling if we can't upgrade
This commit is contained in:
Tony Murray
2022-04-07 21:08:43 -05:00
committed by GitHub
parent b3019f7944
commit 686a27f680

View File

@@ -49,8 +49,12 @@ class Handler extends ExceptionHandler
// try to upgrade generic exceptions to more specific ones
if (! config('app.debug')) {
if ($exception instanceof \Illuminate\View\ViewException || $exception instanceof \Facade\Ignition\Exceptions\ViewException) {
$base = $exception->getPrevious(); // get real exception
}
foreach ($this->upgradable as $class) {
if ($new = $class::upgrade($exception)) {
if ($new = $class::upgrade($base ?? $exception)) {
return parent::render($request, $new);
}
}