Re: Exceptions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Peter,

you are doing something called swallowing the exception.  it may make sense
for your application to
continue processing if the closeCallTracker method throws an error, but at a
minimum you should
log the details of the exception so that you know why its occurring;
something like:

try {
   closeCallTracker($appId, $salesRepId);
} catch (Exception $e) {
   // No need to display anything to user if call tracker is not closed
   MyPHPLog::logMsg($e->getMessage());
}

also, i would assume processing does continue after you swallow the
exception.  in order to determine
why a blank page is displaying you should follow the logic in your
application to the point where it sends
html to the client browser during a case where the closeCallTracker() method
throws an error.

-nathan

On 8/9/07, Peter Pan <qbfreak@xxxxxxxxxxx> wrote:
>
> Peeps,
>
> I'm having an issue where throwing Exceptions are displaying a blank page
> even though the Exception is being caught in a try...catch
> statement.  This
> is happening on our production server where warnings, errors, exceptions,
> etc. are not to be displayed to the user.  The assumption is that even
> though an Exception is being thrown it should be caught rather than
> displaying a blank page.  Is there a specific configuration variable that
> needs to be set in php.ini to allow warnings to not be displayed but
> Exceptions to still be caught?  Or is this just a bug?  Here is some code
> that replicates the issue:
>
> try {
>     closeCallTracker($appId, $salesRepId);
> } catch (Exception $e) {
>     // No need to display anything to user if call tracker is not closed
> }
>
> function closeCallTracker($appId, $salesRepId) {
>
>    // Some code here...
>
>    // A pretty near example of why the Exception is being thrown in our
> system
>    if ($callTrackerAlreadyClosed) {
>       throw new Exception('Can not close a call tracker that has already
> been closed.');
>    }
> }
>
> I'm expecting the program to continue as normal as the Exception has been
> caught appropriately... but instead this code is displaying a blank page.
>
> We're using PHP: 5.1.2 on SuSe
>
> This is really a bizarre issue and any help would be greatly appreciated.
> I've searched PHP.net and Google far too long on this issue.  Thank you in
> advance.
>
> -ec
>
> _________________________________________________________________
> Learn.Laugh.Share. Reallivemoms is right place!
> http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux