Here’s my code:
if(!$fileContents = file_get_contents($pathToXMLFile,true))
{
throw new RuntimeException("Could not open .xml file");
}
I would like to catch this error as an Exception so that I can handle it appropriately. However, it seems that the script aborts before I get the change to catch it. Is there any workaround to this?
P.S.: When I try and do that, I only get a faile to open stream. No such file or directory error message.
Thanks in advance
This will convert all errors, warnings and notices to exceptions: