warning instead of php exception? -
i have piece of code:
try { foreach($obj_c->getgalleries($db_conn1) $gallery) { $gallery->save($db_conn1); } $k = 0; $testing_the_exception = 15/$k; //settin status 1... $obj_c->set_exec_status(3, 1, $db_conn1); } catch (exception $e) { //settin status 3... $obj_c->set_exec_status(3, 3, $db_conn1); echo 'caught exception: ', $e->getmessage(), "\n"; } unset($obj_c);
the fact should entering catch part, because of division 0 exception, instead popping warning , continuing set status 1. expected behaviour? lot in advance.
this more a wholesale solution. set error reporting throw exceptions:
<?php function exception_error_handler($errno, $errstr, $errfile, $errline ) { throw new errorexception($errstr, $errno, 0, $errfile, $errline); } set_error_handler("exception_error_handler"); /* trigger exception */ strpos(); ?>
this example set_error_handler
documentation on php.net
Comments
Post a Comment