Re: Exceptions

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

 



Nathan,

I was hoping for a bug! I'll take a deeper look at the ini. More research is needed, me thinks.

It's become apparent that throwing an Exception for this particular case doesn't really make sense. I'll just return early rather than throwing an exception. The logging suggestion is a great idea, but not realistic given the amount of times this function is called.

Thank you for your help!  I'll update the list with my findings.

-ec

From: "Nathan Nobbe" <quickshiftin@xxxxxxxxx>
To: "Peter Pan" <qbfreak@xxxxxxxxxxx>
CC: php-general@xxxxxxxxxxxxx
Subject: Re:  Exceptions
Date: Thu, 9 Aug 2007 13:00:51 -0400

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
>
>

_________________________________________________________________
Messenger Café ? open for fun 24/7. Hot games, cool activities served daily. Visit now. http://cafemessenger.com?ocid=TXT_TAGHM_AugHMtagline

--
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