I am a .net developer and now I started php. I have a problem handling errors in my custom module.
The module is creating CCK node from an xml input. The problem appears if there are errors in the xml file.
My code looks like:
if(!nodeExist(nid)(
{
try{
$node = CreateNode($xml);
SaveNode($node);
}
catch(Exception $e)
{...}
}
The idea is that I don't want to save a node if there was an error in CreateNode function. If the xml is not valid I get errors and function drupal_error_handler is called ... but nothing is thrown.
Do I have to manually check everything for errors in CreateNode function?
How do you usually approach this problem in php? Can I check if drupal_error_handler was called ... or if there is an error in stack somewhere?
Thanks,
Radu