line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
########################################################################### |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Exception class definitions for Apache Voodoo. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
########################################################################### |
6
|
|
|
|
|
|
|
package Apache::Voodoo::Exception; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = "3.0200"; |
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
56891
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
203
|
|
11
|
6
|
|
|
6
|
|
32
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
6345
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Exception::Class ( |
14
|
6
|
|
|
|
|
257
|
'Apache::Voodoo::Exception', |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::Compilation' => { |
17
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception', |
18
|
|
|
|
|
|
|
description => 'Module compilation failed', |
19
|
|
|
|
|
|
|
fields => ['module'] |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::RunTime' => { |
22
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception', |
23
|
|
|
|
|
|
|
description => 'Run time exception from perl' |
24
|
|
|
|
|
|
|
}, |
25
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::RunTime::Thrown' => { |
26
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception::RunTime', |
27
|
|
|
|
|
|
|
description => 'Module threw an exception' |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::RunTime::BadConfig' => { |
30
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception::RunTime', |
31
|
|
|
|
|
|
|
description => "Configuration Error", |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::RunTime::BadCommand' => { |
34
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception::RunTime', |
35
|
|
|
|
|
|
|
description => "Controller returned an unsupported command", |
36
|
|
|
|
|
|
|
fields => ['module', 'method', 'command'] |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::RunTime::BadReturn' => { |
39
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception::RunTime', |
40
|
|
|
|
|
|
|
description => "Controller didn't return a hash reference", |
41
|
|
|
|
|
|
|
fields => ['module', 'method', 'data'] |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::ParamParse' => { |
44
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception', |
45
|
|
|
|
|
|
|
description => 'Parameters failed to parse' |
46
|
|
|
|
|
|
|
}, |
47
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::DBIConnect' => { |
48
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception', |
49
|
|
|
|
|
|
|
description => 'Failed to connect to the database' |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::Application' => { |
52
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception', |
53
|
|
|
|
|
|
|
description => 'Application Error' |
54
|
|
|
|
|
|
|
}, |
55
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::Application::SessionTimeout' => { |
56
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception::Application', |
57
|
|
|
|
|
|
|
description => "Session has expired", |
58
|
|
|
|
|
|
|
fields => ['target'] |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::Application::Redirect' => { |
61
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception::Application', |
62
|
|
|
|
|
|
|
description => "Controller redirected the request to another location", |
63
|
|
|
|
|
|
|
fields => ['target'] |
64
|
|
|
|
|
|
|
}, |
65
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::Application::DisplayError' => { |
66
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception::Application', |
67
|
|
|
|
|
|
|
description => "Controller request the display of an error message", |
68
|
|
|
|
|
|
|
fields => ['code','target','detail'] |
69
|
|
|
|
|
|
|
}, |
70
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::Application::AccessDenied' => { |
71
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception::Application', |
72
|
|
|
|
|
|
|
description => "Access to the requested resource has been denied", |
73
|
|
|
|
|
|
|
fields => ['target','detail'] |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::Application::Unauthorized' => { |
76
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception::Application', |
77
|
|
|
|
|
|
|
description => "Access to the requested resource has been denied" |
78
|
|
|
|
|
|
|
}, |
79
|
|
|
|
|
|
|
'Apache::Voodoo::Exception::Application::RawData' => { |
80
|
|
|
|
|
|
|
isa => 'Apache::Voodoo::Exception::Application', |
81
|
|
|
|
|
|
|
description => "Controller returned a raw data stream", |
82
|
|
|
|
|
|
|
fields => ['headers','content_type','data'] |
83
|
|
|
|
|
|
|
}, |
84
|
6
|
|
|
6
|
|
7111
|
); |
|
6
|
|
|
|
|
76842
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Apache::Voodoo::Exception::RunTime->Trace(1); |
87
|
|
|
|
|
|
|
Apache::Voodoo::Exception::RunTime->NoRefs(0); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub parse_stack_trace { |
90
|
0
|
|
|
0
|
0
|
|
my $trace = shift; |
91
|
|
|
|
|
|
|
|
92
|
0
|
0
|
|
|
|
|
unless (ref($trace) eq "Devel::StackTrace") { |
93
|
0
|
|
|
|
|
|
return []; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
my @trace; |
97
|
0
|
|
|
|
|
|
my $i = 1; |
98
|
0
|
|
|
|
|
|
while (my $frame = $trace->frame($i++)) { |
99
|
0
|
0
|
|
|
|
|
last if ($frame->package =~ /^Apache::Voodoo::Engine/); |
100
|
0
|
0
|
|
|
|
|
next if ($frame->package =~ /^Apache::Voodoo/); |
101
|
0
|
0
|
|
|
|
|
next if ($frame->package =~ /(eval)/); |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
my $nf = $trace->frame($i); |
104
|
0
|
|
|
|
|
|
my $subroutine; |
105
|
|
|
|
|
|
|
my @args; |
106
|
0
|
0
|
|
|
|
|
if ($nf) { |
107
|
0
|
|
|
|
|
|
$subroutine = $nf->subroutine; |
108
|
0
|
|
|
|
|
|
@args = $nf->args; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
0
|
|
|
|
my $f = { |
112
|
|
|
|
|
|
|
'class' => $frame->package, |
113
|
|
|
|
|
|
|
'function' => $subroutine || '', |
114
|
|
|
|
|
|
|
'file' => $frame->filename, |
115
|
|
|
|
|
|
|
'line' => $frame->line, |
116
|
|
|
|
|
|
|
}; |
117
|
0
|
|
|
|
|
|
$f->{'function'} =~ s/^$f->{'class'}:://; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# if the first item is a reference to same class, then this was a method call |
120
|
0
|
0
|
|
|
|
|
if (ref($args[0]) eq $f->{'class'}) { |
121
|
0
|
|
|
|
|
|
shift @args; |
122
|
0
|
|
|
|
|
|
$f->{'type'} = '->'; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
else { |
125
|
0
|
|
|
|
|
|
$f->{'type'} = '::'; |
126
|
|
|
|
|
|
|
} |
127
|
0
|
|
|
|
|
|
$f->{'args'} = join(",",@args); |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
push(@trace,$f); |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
} |
132
|
0
|
|
|
|
|
|
return \@trace; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
################################################################################ |
138
|
|
|
|
|
|
|
# Copyright (c) 2005-2010 Steven Edwards (maverick@smurfbane.org). |
139
|
|
|
|
|
|
|
# All rights reserved. |
140
|
|
|
|
|
|
|
# |
141
|
|
|
|
|
|
|
# You may use and distribute Apache::Voodoo under the terms described in the |
142
|
|
|
|
|
|
|
# LICENSE file include in this package. The summary is it's a legalese version |
143
|
|
|
|
|
|
|
# of the Artistic License :) |
144
|
|
|
|
|
|
|
# |
145
|
|
|
|
|
|
|
################################################################################ |