How can one gracefully address this kind of error?

Hi! Instead of showing the error message below, how can we handle, in a user friendly way, those kind of errors: validation, duplicated key, deletion forbiden by foreing key dependency etc…

It would be great if we can catch those exceptions.

Thanks in advance.

CRITICAL - 2024-01-19 15:26:35 --> GroceryCrud\Core\Exceptions\Exception: There were some validation errors with the upload:
- File "IMG_6402.jpeg": File size is too large.
in VENDORPATH/grocery-crud/enterprise/src/GroceryCrud/Core/State/StateAbstract.php on line 589.
 1 VENDORPATH/grocery-crud/enterprise/src/GroceryCrud/Core/State/InsertState.php(82): GroceryCrud\Core\State\StateAbstract->uploadOneData()
 2 VENDORPATH/grocery-crud/enterprise/src/GroceryCrud/Core/GroceryCrud.php(2932): GroceryCrud\Core\State\InsertState->render()
 3 APPPATH/Controllers/User/ProdutosUsuario.php(218): GroceryCrud\Core\GroceryCrud->render()
 4 SYSTEMPATH/CodeIgniter.php(941): App\Controllers\User\ProdutosUsuario->index()
 5 SYSTEMPATH/CodeIgniter.php(502): CodeIgniter\CodeIgniter->runController()
 6 SYSTEMPATH/CodeIgniter.php(361): CodeIgniter\CodeIgniter->handleRequest()
 7 FCPATH/index.php(79): CodeIgniter\CodeIgniter->run()

Hello @bgeneto ,

That’s weird because this exception is handled by Grocery CRUD itself. For example in my local system I am getting this error instead:

I will check maybe it is a Codeigniter 4 handling this exception differently?

Regards
Johnny