I am trying to catch a runtime exception that will be thrown by a function that is basically just a wrapper function for oci_execute(). For example:
try {
$SQL = "INSERT";
ExecuteQuery($SQL);
} catch (Exception $e) {
echo "<p>There was an error.</p>";
echo $e->getMessage();
}
However, the exception doesn't appear to be caught:
...
ociexecute() [function.ociexecute]: ORA-00925: missing INTO keyword
...
Am I missing something here?
It looks like it's triggering an error rather than throwing an exception.
You could convert errors to exceptions using set_error_handler() - something like this:
function errorHandler($number, $string, $file = 'Unknown', $line = 0, $context = array())
{
if (($number == E_NOTICE) || ($number == E_STRICT))
return false;
if (!error_reporting())
return false;
throw new Exception($string, $number);
return true;
}
set_error_handler('errorHandler');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With