I have an application based on Zend Framwork. In one model, I call a method from another model. When I call this method, I use the try-cath block to handle strange situations. Model1.
try {
$result = Module_Model2_Name->method();
} catch (Exception $e) {
}
Catch should work if we find a throw in the try block. But I do not know about the behavior of my application. If this is some application error in the Model2 method, this should be an Exception. In the Model2 method, I do the following, but this does not work:
set_error_handler(create_function('$m = "Error"','throw new Exception($m);'), E_ALL);
How can I throw an exception on every error of a PHP application? Many thanks. Sorry for my English.
pltvs source
share