Please Help! Why does Filament show a modal error for form operation errors ?
What I am trying to do:
I am trying to understand the behavior of Filament's error handling during form operations.
What I did:
I have been using Filament and noticed that it displays different types of error pages for different issues.
My issue/the error:
I set .env
APP_DEBUG=false
. When an error occurs during a form operation, Filament shows a modal error page, e.g., 500 error. However, when there is a permission error, it shows a full-page error. I am trying to understand the reason behind this difference in error handling.
Code:
N/ASolution:Jump to solution
Livewire throws errors in a modal because they are happening in an Ajax request. The full page error is when laravel throws an exception during the normal application flow.
11 Replies
afaik filament don't handle this kind of error, livewire/laravel did. and what is your
APP_ENV
?Thank you for your response!
My APP_ENV is set to production.
can you show what kind of permission error showing in full page when
APP_ENV=production
and app_debug=false
For example, after enabling multi-tenancy, if you try to access a tenant you don't have permission for, you will get a 403 full-page error.
![No description](https://cdn.answeroverflow.com/1261221186449313852/image.png)
Another type of error is a modal error. For example, if there is a field
start_date
of type timestamp, due to the MySQL 2038 issue, saving a date beyond 2038 will result in an error.![No description](https://cdn.answeroverflow.com/1261223738490359818/image.png)
![No description](https://cdn.answeroverflow.com/1261223738922369064/image.png)
Enable debug mode, see what the error is. Where is your model?
I would like to understand why sometimes the error appears as a modal instead of a full-page error.
One will be when editing in a modal, or by an ajax request
A new page, is when submitting/rendering a page
I suspect the errors are different, 500 just means server coding issue.
Solution
Livewire throws errors in a modal because they are happening in an Ajax request. The full page error is when laravel throws an exception during the normal application flow.
I appreciate it. Thanks! ❤️