[nycphp-talk] NEW PHundamentals Question - Error Handling
Tim Gales
tgales at tgaconnect.com
Mon May 10 08:38:50 EDT 2004
Indeed something can always go wrong.
Good error handling should take a page
out of basic journalism's playbook.
when something goes wrong you want to
know the five W's --
Who, What, Where, When, and How.
Roughly speaking there are three Where's:
Hardware (e.g. disk full)
OS or system (e.g. a process never gets
environment scheduled for some reason --
that is, it doesn't seem to
be running for lack of a
'time slice')
Software (this includes utility software
like a compiler generating
some sort of 'wrong stuff' and
the developers' logic flaws in
the application software)
Basically the Who's are determine by what
mode the code is running in. For example:
kernel mode, user mode etc.
The what's are generally governed by the
Where's. For instance in unix-like operating
systems events may be signaled. On a specific
CPU the hardware may 'trap' to a vector
interrupt when you try to divide by zero.
In application software (or frameworks as well)
there will quite likely be a list of possible
exceptions.
When's are not only the time according to
the system clock, but also the order in
which things have happened like a misbehaving
routine was called just after calling some
other routine (generally you can get this
type of information from some sort of
stack trace).
Putting all the W's together show help
to come up with an answer for the big 'W' --
WHY did something go wrong?
In trying to answer the big W you sometimes
can find yourself sounding like a member on
a congressional investigation committee.
Saying to yourself things like:
"What did this routine know -- and when did
he know it".
T. Gales & Associates
'Helping People Connect with Technology'
http://www.tgaconnect.com
> -----Original Message-----
> From: talk-bounces at lists.nyphp.org
> [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Jeff
> Siegel - PHundamentals
> Sent: Monday, May 10, 2004 7:31 AM
> To: NYPHP Talk
> Subject: [nycphp-talk] NEW PHundamentals Question - Error Handling
>
>
> "Something can always go wrong in an application so it is
> essential that
> your application have an error handler. What types of errors can be
> safely ignored, and which ones should be trapped by an error handler?
> What is the best way to handle those errors?"
>
> Jeff Siegel & Michael Southwell
> The PHundamentals Team
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org http://lists.nyphp.org/mailman/listinfo/talk
>
More information about the talk
mailing list