Support the ongoing development of Laravel.io →
Database Eloquent IOC

For some reason, I cannot catch DB exceptions inside a seed class: the code never enters the catch block.

I always get this error:

PHP Warning: Uncaught exception 'Illuminate\Database\QueryException'

I am able to do elsewhere, for example in the routes.php file.

I tried to catch Exception, \Exception, \PDOException, \Illuminate\Database\QueryException and so on, but I had no luck.

Any idea?

Thanks for your help.

Last updated 3 years ago.
0
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

eleftrik eleftrik Joined 15 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.