Solved

PHP 5 Exception recovery

Posted on 2007-04-10
1
521 Views
Last Modified: 2010-08-05
Can you resume execution after an uncaught exception is picked up by the customized exception handler?

For example, in my error class:

set_exception_handler("userExceptionHandler");

If I have code that throws an exception which is not caught, userExceptionHandler() catches and handles it.  Can I recover from there?
0
Comment
Question by:Steve Bink
1 Comment
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 18887773
No, if the exception is handled by the global exception handler The script finish after that point. Example:

function myExceptionHandler (Exception $ex) { return true; }
set_exception_handler("myExceptionHandler");
throw new Exception("This should cause a fatal error and this message will be lost");
echo "Test";

'Test' is never printed.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Reference key in foreach loop 4 42
Unwanted output from my query 5 43
Echo'd values in dropdowns 6 32
Json encode, change how it looks like on when inserting to database 14 28
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question