Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^2: Friendly error trapping

by monarch (Priest)
on Sep 13, 2005 at 01:37 UTC ( #491432=note: print w/replies, xml ) Need Help??

in reply to Re: Friendly error trapping
in thread Friendly error trapping

The question made sense.

dieing is the right response when something occurs in code that the programmer was not expecting or hasn't got around to handling.

On the other hand, as graff points out, when an error condition can be anticipated then testing for that error and producing an alternative response is a great thing to do.

For example, in a commercial web app, it is conceivable that a database handle may not be obtained (high load, some tweap in operations decided to take the db offline, sunspot interference). What to do in the situation.. die and leave the user hanging? No; probably a more adequate response is a "website is busy, please return back soon!". If the webpage just died then it would be particularly unpretty and unprofessional.

Of course, if that multiline if..elsif..elsif.. statement falls through to a final else that should be impossible, then die and die spectacularly.. the programmer needs to urgently tend to the impossible!

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://491432]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2023-01-30 12:25 GMT
Find Nodes?
    Voting Booth?

    No recent polls found