Jump to content

Archived

This topic is now archived and is closed to further replies.

pkrtech

DOM Error supression

Recommended Posts

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);

Share this post


Link to post
Share on other sites
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.
[code]<?php
if(!@$xdom->load($cycle)){
    throw new MyCustomException('message');
}
?>[/code]

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.