|Perl: the Markov chain saw|
Re: Handle application errors with mod_perlby sundialsvc4 (Monsignor)
|on Feb 07, 2013 at 20:58 UTC||Need Help??|
Gentlebeings ... a moment’s respectful pause, I beseech thee ...
The root cause of the problem, with respect to this mod_perl-based application, is not that a misfortunate error occurred ... but that the consequence of that error, when it misfortunately occurred, was that the exception blew all the way out to “Apache, itself.” Any self-respecting web application, in whatever implementation-language it might be, must be able to keep up a good face in front of its audience while the show is going on, no matter what sort of calamity is happening backstage.
“Ladies and Gentlemen, good evening. I’m very sorry, but the entire back-half of the theater has just been consumed by an unanticipated thermonuclear fusion reaction. Will you please now gather your coats and exit through the doorways to the left or to the right. You may exchange your tickets for a full refund at the box-office tomorrow morning if the aforesaid box office is still here. Thank you, and good night.” Grace under pressure.
“SQL errors,” (will surprises never cease??) ... guess what ... sh*t happens. Just like any other sh*t that “could happen.” But the bottom line is ... no matter what happens, you gotta save face in front of the customer.
Ergo: you must, above all else, ensure that there is “an exception-handler of last resort.” And, having built that, you must likewise ensure that it does something reasonable. Hand the doomed customer a free drink along with his life-jacket. But don’t, whatever you do, actually let the airplane hit the ground. That’s not “Perl” ... that’s not even “web.” That’s just common sense.
The second point, likewise, is “just common sense.” If the theater that you are running has just experienced a thermonuclear meltdown, for reasons that you particularly know not, then it just might be prudent to commit suicide, so that the operating system will obliterate all the wreckage. Apache, in its turn, will then spawn a brand new clean-slate.
Hey ... if that “bothers you,” then with my blessings please down-vote this response to your heart’s content and have a wonderfully nice day.