Why do my Filament error reports show that they're all coming from my middleware?

I've noticed this for a awhile, but an error that occurs during filament's business logic always returns a specific error correctly like "UnexpectedValueException: Queried value for public_phone is not in international format" but then incorrectly shows the line as being "app/Http/Middleware/SetLastActivityMiddleware.php:26" or whatever my final middlware is. Line 26 in that file is just return $next($request);
4 Replies
toeknee
toeknee3mo ago
Probably a bad code and the middleware is catching the exception and throwing it when it can’t proceed with its checks
awcodes
awcodes3mo ago
If you’re seeing that on the error page there is a drop down to show all the vendor frames which expands the stack trace so you can step through it.
Citizen
CitizenOP3mo ago
The trigger in this specific case is just a casts that is producing an error when trying to display in a filament table. The stack trace does reveal where the issue is, I'm just curious why it shows up as the last middleware. If I remove my custom middleware it will just default to whatever the last middleware was.
awcodes
awcodes3mo ago
My best guess is that it’s a propagation thing with the exceptions and the point at which livewire bubbles them up. Essentially livewire requests are an api using ajax so that can’t fully tap in to the normal exception handling since it’s not a full app lifecycle request.

Did you find this page helpful?