koha-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-devel] Koha Day - CGI::Carp error handling


From: Mason James
Subject: [Koha-devel] Koha Day - CGI::Carp error handling
Date: Mon, 24 Sep 2007 11:48:10 +1200

Hi Koha-Devel, 

There has been a little talk recently on the koha-devel list about error handling in Koha. 

Chris and I spent some time on Friday(nz time) to work out a relatively small and tidy way, using CGI::Carp, to trap and redirect most runtime errors in Koha to the user's browser.

We have made a System-Preference called DebugLevel, that has currently 3 values 0, 1 and 2. (more?)

something like... ???
0 is Quiet - For production
1 is Developer - For debugging
2 is Logging - Bug reporting , and additional package version info too, like Apache, MySQL, Perl,YAZ, Z9350::ZOOM MARC::Record/Charset....


The CGI::Carp stuff has been added near the start of Output.pm, so it's set up nice and early to handle (and output) any later errors.
I committed the CGI::Carp stuff to dev_week, but if people like the idea, I'll commit it to rel_3 too...

Here is the commit to Output.pm below.
http://cvs.savannah.nongnu.org/viewvc/koha/C4/Output.pm?root=koha&r1=1.51.2.2.2.1&r2=1.51.2.2.2.2&pathrev=dev_week


Using CGI::Carp with the DebugLevel syspref at '2',  Koha now handles this example script's syntax error.
----------------------------------
#!/usr/bin/perl
use C4::Output;

ndjsnsjkcndjkscndjskcndjks
exit;
------------------------------------


And sends Perl's error message back to he user's browser for either debugging further, or perhaps attaching to a bug report, or to the bottom of a koha-devel list email.

Like this below....
----------------------------------
debug level 2

Got an error: syntax error at /koha/dev_week/intranet/cgi-bin/misc/carp_test.pl line 6, near "ndjsnsjkcndjkscndjskcndjks exit" 
Execution of /koha/dev_week/intranet/cgi-bin/misc/carp_test.pl aborted due to compilation errors.

Koha 2.2.8
Perl 5.008008
MySQL mysql Ver 14.12 Distrib 5.0.32, for pc-linux-gnu (i486) using readline 5.2
OS Linux arwen.metavore.com 2.6.18-4-686 #1 SMP Mon Mar 26 17:17:36 UTC 2007 i686 GNU/Linux
Apache Server version: Apache/2.2.3 Server built: Jun 17 2007 20:24:06
----------------------------------

How does this sound, 
Any improvements suggestions or corrections?


Cheers, Mason

--
Mason James                                address@hidden
Programmer                                         www.liblime.com
LibLime                                             +64 21 542 117

reply via email to

[Prev in Thread] Current Thread [Next in Thread]