Welcome Guest, Not a member yet? Register   Sign In
Try catch is not working
#1

Im trying to catch errors when data is not inserted on the database.
This is may code:
try {
$id = (new CatalogModel)->create([
'role' => post('role'),
'title' => post('title'),
]);
model('App\Models\ActivityLogModel')->add('Se ha creado un nuevo grupo: '.$id.' Creado por: '.logged('name'), logged('id'));
} catch (\Exception $e) {
model('App\Models\ActivityLogModel')->add('Error al crear grupos:'. $e->errorMessage(), logged('id'));
}

But its not working and allways redirect to error page (errors/html/production.php).

Any help on this?
Reply


Messages In This Thread
Try catch is not working - by rav1971 - 10-12-2024, 09:16 PM
RE: Try catch is not working - by sikander - 10-15-2024, 08:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB