Jump to content


Photo

DOM Error supression


  • Please log in to reply
1 reply to this topic

#1 pkrtech

pkrtech
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 25 August 2006 - 06:52 AM

if the XML file it is trying to call is not their it throws up errors how do I supress them so it continues the script and reports the error to me through mail().

$xdom = new domDocument;
$xdom->load($cycle);

#2 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 25 August 2006 - 07:07 AM

Well, normally you would use an custom errorhandler. But since you're into OOP you could also use exceptions. I've been meaning to get further into that myself.

You can use the '@' to supress an error, then use the returnvalue to check if your want to throw your custom exception.
<?php
if(!@$xdom->load($cycle)){
    throw new MyCustomException('message');
}
?>

I'm not sure that's the best way to that, like I said, I've been meaning to look into it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users