Placement of exception errors
Posted: Fri Jan 15, 2010 1:04 pm
Hey PHP Gurus you recently showed me how I can use exception handleing in my web application and it works great, I just got one more problem with errors bugging me now though.
The situation is I have a form which uses exceptions when submitted, all the exception code is at the very top of the document thats including the catch blocks. Now this displays errors on the very top of the page above the template obviously. This is no good as it breaks my template so i need to place the errors in the body part of the document. I have tried putting the catch blocks in the body but then the code inbetween the catch blocks and the new exception is not read so it results in half the template missing.
How can I get the error messages from the catch blocks to display in the body without loosing half the template.
This is the error message code:
The situation is I have a form which uses exceptions when submitted, all the exception code is at the very top of the document thats including the catch blocks. Now this displays errors on the very top of the page above the template obviously. This is no good as it breaks my template so i need to place the errors in the body part of the document. I have tried putting the catch blocks in the body but then the code inbetween the catch blocks and the new exception is not read so it results in half the template missing.
How can I get the error messages from the catch blocks to display in the body without loosing half the template.
This is the error message code:
Code: Select all
// if successfully insert data into database, displays message "Successful".
if($sql){
echo "Thank you for submiting your job, our team will now take a look and approve very soon ";
echo "<BR>";
echo "$feature";
echo "<a href='/jobs.php'>Click here to go back</a>";
}
else {
echo "ERROR";
}
} catch (customException $e)
{
echo $e->errorMessage();
}
catch (workersException $e)
{
echo $e->errorMessage2();
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
}