« Back to the index
\core\WATrowable, \core\WAError examples
starttransaction();
// INSERTING INTO THE DATABASE
// $db->insert($data);
// insert can throw an EXCEPTION
if (1 == 1)
throw new \core\WAException('Error inserting the data: there is a duplicate key.');
// DATABASE COMMIT
// $db->commit();
}
catch (\core\WAException $e)
{
// DATABASE ROLLBACK
// $db->roolback();
// PRINT THE EXCEPTION OR DO WHATEVER YOU WANT WITH IT
print $e;
}
}
catch (\Throwable $t)
{
print "There was an severe error in the application:";
print $t;
}
?>
« Back to the index