Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Catching errors.

by saberworks (Curate)
on Apr 02, 2013 at 19:38 UTC ( [id://1026751]=note: print w/replies, xml ) Need Help??


in reply to Catching errors.

Well, you need to hook into where your app is attempting to do the work in the first place. So figuring out whether help is missing, how do you load the help? If you are loading from a file, you'd have to test if the file exists before you attempt to load it.
if(! -f $expected_help_file) { # send your message }
Same with translation.

For your SQL errors, file errors, sounds like you already have something in mind (custom die function). To trap those as well as any way the program as a whole can die, you can set a SIG die handler, as described in Perl's Warn and Die Signals. This will be run every time something dies (be careful, it also gets run when a die happens in an eval, and there are examples of how to detect and ignore that case). Also you need to be careful not to rely on too much extra stuff in your die handler, the less the better. If your app died because your database connection went away and then your die handler tries to use the db connection to grab a developer email address, it obviously won't work properly.

We also have processes that log any warnings that are emitted and those are looked at on a regular basis as they often alert us to problematic code before it gets out into production.

Replies are listed 'Best First'.
Re^2: Catching errors.
by Steve_BZ (Chaplain) on Apr 12, 2013 at 18:31 UTC

    Hi Saberworks,

    To trap those as well as any way the program as a whole can die, you can set a SIG die handler

    This is exacly what I want. Then I can write a handler that runs on autostart, runs my program, and then when it finishes I can check the exit code for errors.

    I'll try that.

    Regards

    Steve

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-29 15:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found