Add backtrace printing option through SetEnv KOHA_BACKTRACES 1
authorMJ Ray <mjr@phonecoop.coop>
Tue, 1 Apr 2008 18:29:18 +0000 (19:29 +0100)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 3 Apr 2008 19:44:31 +0000 (14:44 -0500)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Context.pm

index 4dcd743..e81fd95 100644 (file)
@@ -64,6 +64,11 @@ BEGIN {
                 print "</body></html>";
                        }
                CGI::Carp::set_message(\&handle_errors);
+               ## give a stack backtrace if KOHA_BACKTRACES is set
+               ## can't rely on DebugLevel for this, as we're not yet connected
+               if ($ENV{KOHA_BACKTRACES}) {
+                       $main::SIG{__DIE__} = \&CGI::Carp::confess;
+               }
     }          # else there is no browser to send fatals to!
        $VERSION = '3.00.00.036';
 }