NYCPHP Meetup

NYPHP.org

[nycphp-talk] New PHundamentals Article - Error Handling

inforequest sm11szw02 at sneakemail.com
Mon Jul 19 14:55:38 EDT 2004


Jeff Siegel - PHundamentals jeff.siegel-at-nyphp.org |nyphp 04/2004| wrote:

> A new PHundamentals article - "Error Handling" - has been posted. This 
> article is in beta form, subject to one last round of feedback from 
> the NYPHP community. Please post any questions or comments about the 
> article by replying to this message.
>
> See: 
> http://phundamentals.nyphp.org/PH_error_handle.php?expiredate=8/2/2004
>
> ==================
> Jeff Siegel & Michael Southwell
> The PHundamentals Team


I promise after this one I will shut up  :-)

Sending admin emails upon error catch - I don't consider this a good 
idea in general, although of course it is widely done and perhaps really 
only meant as an example. It is "open loop" in that a server problem or 
mail sending problem results in "no error reporting" - which simply 
hides the errors. IOW, if e-massages are not displayed, and email 
doesn't get sent, who knows there is a problem?

I would recommend the displayed error message tactfully inform the user 
the admins have been made aware of the problem, as you suggest, but I 
would also tell the viewer to contact the sysadmin if the error is not 
resolved promptly. I would provide an email addy for doing so - (a 
different one). Yes it is true you don't want the user to be the one who 
tells you there' a problem, but if that's the only way you'll find out, 
isn't that better than having the system remain dysfunctional? I doubt 
many users will contact the sysadmin unless it is down for a long 
time... or the boss browses the site and sees that message.

A few admin emails per second on the same database connect error is not 
really very helpful, especially if you're away for the day. Since 
exception handlers are expected to be called infrequently, why not make 
them smarter than that... if already sent in last few minutes, if 
semaphore is present/not present, if already 2 hours of the same 
problem, enable redirects to static pages, disable login with friendly 
maintenance message,  etc.... After all, if it's being done with PHP, 
why not make it smart (or suggest that you can do that?).

Not mant to be critical as much as constructive! Except for the 
un-search-engine-friendly-semantics of the name, I love the 
phundamentals program!


-=john





More information about the talk mailing list