Many of my try/catch blocks have suddenly stopped working. When I throw an exception, the corresponding catch block is ignored, and I'm given the error message:
Fatal error: Uncaught exception 'Exception' with message 'Please ensure that all fields are filled out.' in /home/ goddess/ public_html/ add_blog.php:20 Stack trace: #0 {main} thrown in /home/ goddess/ public_html/add_blog.php on line 20.
I'm baffled! Any ideas why the following block of code would generate such an error message?
try
{
check_valid_user();
if (!filled_out($_POST))
{
throw new Exception('Please ensure that all fields are filled out.');
}
// attempt to add blog
publish_blog($blog_author, $blog_title, $blog_body);
echo 'Blog successfully published!';
}
catch (Exception $e)
{
echo $e->getMessage();
}
display_user_menu();
do_html_footer();
?>
2007-02-28
05:44:27
·
4 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Programming & Design