Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Useless/Interesting Error Messages

by sfink (Deacon)
on Mar 08, 2005 at 05:47 UTC ( #437422=note: print w/ replies, xml ) Need Help??


in reply to Useless/Interesting Error Messages

At my last company I had a global variable containing the current error message (much like errno, only a descriptive string rather than an integer). Whenever an error was detected, I would set it to an appropriate message and return -1. A caller would detect the failure and print out the global error descriptor. (This was in C, btw.)

When running under the debugger, it was useful to have an easily recognizable value that would indicate that no error had happened yet, so I initialized it to "Life is good".

Unsurprisingly, I ended up with a number of routines that didn't bother to set the error message, but still returned -1. So it became fairly common to see messages like:

Fatal error, unable to continue: Life is good


Comment on Re: Useless/Interesting Error Messages

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2015-08-31 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (351 votes), past polls