Welcome Guest, Not a member yet? Register   Sign In
Database Error Handling
#4

> In that model or controller, the try/catch doesn't work.

Are you sure you are catching the right thing? Exceptions must be fully-qualified when you catch them from a namespace. You could try:

try
{
$db->query($sql);
}
catch (\Throwable $e)
{
...

Notice the preceding \ on the class to catch.
Reply


Messages In This Thread
Database Error Handling - by next2heaven - 04-17-2020, 09:46 AM
RE: Database Error Handling - by captain-sensible - 04-17-2020, 11:22 AM
RE: Database Error Handling - by next2heaven - 04-17-2020, 02:01 PM
RE: Database Error Handling - by MGatner - 04-22-2020, 04:37 AM
RE: Database Error Handling - by next2heaven - 04-22-2020, 08:31 AM
RE: Database Error Handling - by jreklund - 04-22-2020, 11:11 AM
RE: Database Error Handling - by next2heaven - 04-22-2020, 11:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB