'Exception: Undefined property: Livewire\Redirector::$headers error when redirecting from custom exception handler

This is a Laravel/Livewire problem.

I get the exception, Exception: Undefined property: Livewire\Redirector::$headers, when redirecting from a custom exception handler.

I'm trying to capture a specific exception (query timeout) that can happen in several different places. I can successfully do that by adding the following to the register() method:

    $this->renderable(function (MyInterestingException $e, $request) {
        // ...

        return redirect()->route('the-route-to-be-redirected-to');
    });

Any help would be appreciated. Thx.

Also, this is basically identical to the following question: I got Livewire\Redirector::$headers error with custom Exception raised



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source