Solved: Errors/ Execptions in PHP
Posted: Tue Mar 17, 2009 10:40 am
I believe I have risen to the level that I need to start "handling" my errors instead of running away from them.
The basic concepts, however, still elude me. Here's an example:
What should happen:
What does happen:
No errors, no exceptions logged. myFile.xml has the expected output.
I thought that after the try block, lines 10 and 11 would get executed? I'm not very familiar with try...catch, so I think it's the problem.
The basic concepts, however, still elude me. Here's an example:
Code: Select all
if (!valid$_POST['requiredThing']){
return 'invalid entry, go back';
}else{
$cornerstone = cornerstonefunc($_POST);
try{
append_myDoc($cornerstone, 'myFile.xml');
}catch(Exception $e){
echo 'Caught Exception: '. $e->getCode() . ' Message: ' . $e->getMessage(). "\n Couldn't save file.";
}
$block1 = $cornerstone->saveXML();
$stuff = $myXSLTrans($block1, 'myXSL.xsl');
}
$output = '<h1>STUFF</h1>' . $stuff . '<p>Hope you enjoyed that.</p>'Code: Select all
[size=150]<h1>STUFF</h1>
<p>XML made HTML!</p>
<p>Hope you enjoyed that.</p>[/size]Code: Select all
[size=150]<h1>STUFF</h1>
<p></p>
<p>Hope you enjoyed that.</p>
[/size]I thought that after the try block, lines 10 and 11 would get executed? I'm not very familiar with try...catch, so I think it's the problem.