| … | |
… | |
| 31 | |
31 | |
| 32 | =cut |
32 | =cut |
| 33 | |
33 | |
| 34 | use strict; |
34 | use strict; |
| 35 | use warnings; |
35 | use warnings; |
| 36 | use DB; |
36 | use Apache::DB; |
| 37 | use WeBWorK; |
37 | use WeBWorK; |
| 38 | |
38 | |
| 39 | sub handler($) { |
39 | sub handler($) { |
| 40 | my ($r) = @_; |
40 | my ($r) = @_; |
| 41 | |
41 | |
| … | |
… | |
| 50 | }; |
50 | }; |
| 51 | |
51 | |
| 52 | # the __DIE__ handler stores the call stack at the time of an error |
52 | # the __DIE__ handler stores the call stack at the time of an error |
| 53 | local $SIG{__DIE__} = sub { |
53 | local $SIG{__DIE__} = sub { |
| 54 | my ($error) = @_; |
54 | my ($error) = @_; |
| 55 | my $trace = join "\n", DB::backtrace(); |
55 | my $trace = join "\n", Apache::DB->backtrace(); |
| 56 | $r->notes("lastCallStack" => $trace); |
56 | $r->notes("lastCallStack" => $trace); |
| 57 | die $error; |
57 | die $error; |
| 58 | }; |
58 | }; |
| 59 | |
59 | |
| 60 | eval { WeBWorK::dispatch($r) }; |
60 | eval { WeBWorK::dispatch($r) }; |