| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
331
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
20
|
|
|
2
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
35
|
|
|
3
|
|
|
|
|
|
|
package Exception::Reporter::Summarizer::ExceptionClass; |
|
4
|
|
|
|
|
|
|
# ABSTRACT: a summarizer for Exception::Class exceptions |
|
5
|
|
|
|
|
|
|
$Exception::Reporter::Summarizer::ExceptionClass::VERSION = '0.013'; |
|
6
|
1
|
|
|
1
|
|
3
|
use parent 'Exception::Reporter::Summarizer'; |
|
|
1
|
|
|
|
|
0
|
|
|
|
1
|
|
|
|
|
4
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#pod =head1 OVERVIEW |
|
9
|
|
|
|
|
|
|
#pod |
|
10
|
|
|
|
|
|
|
#pod This summarizer handles only L objects. A dumped exception |
|
11
|
|
|
|
|
|
|
#pod will result in between one and four summaries: |
|
12
|
|
|
|
|
|
|
#pod |
|
13
|
|
|
|
|
|
|
#pod * a text summary of the exceptions full message |
|
14
|
|
|
|
|
|
|
#pod * if available, a dump of the exception's pid, time, uid, etc. |
|
15
|
|
|
|
|
|
|
#pod * if available, the stringification of the exception's stack trace |
|
16
|
|
|
|
|
|
|
#pod * if any fields are defined, a dump of the exception's fields |
|
17
|
|
|
|
|
|
|
#pod |
|
18
|
|
|
|
|
|
|
#pod =cut |
|
19
|
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
498
|
use Exception::Class 1.30; # NoContextInfo |
|
|
1
|
|
|
|
|
5672
|
|
|
|
1
|
|
|
|
|
3
|
|
|
21
|
1
|
|
|
1
|
|
29
|
use Try::Tiny; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
263
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub can_summarize { |
|
24
|
10
|
|
|
10
|
0
|
10
|
my ($self, $entry) = @_; |
|
25
|
10
|
|
|
10
|
|
25
|
return try { $entry->[1]->isa('Exception::Class::Base') }; |
|
|
10
|
|
|
|
|
115
|
|
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub summarize { |
|
29
|
2
|
|
|
2
|
0
|
3
|
my ($self, $entry, $internal_arg) = @_; |
|
30
|
2
|
|
|
|
|
4
|
my ($name, $exception, $arg) = @$entry; |
|
31
|
|
|
|
|
|
|
|
|
32
|
2
|
|
|
|
|
9
|
my $fn_base = $self->sanitize_filename($name); |
|
33
|
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
7
|
my $ident = $exception->error; |
|
35
|
2
|
|
|
|
|
11
|
($ident) = split /\n/, $ident; # only the first line, please |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Yes, I have seen the case below need handling! -- rjbs, 2012-07-03 |
|
38
|
2
|
50
|
|
|
|
4
|
$ident = "exception of class " . ref $exception unless length $ident; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Another option here is to dump this in a few parts: |
|
41
|
|
|
|
|
|
|
# * a YAML dump of the message, error, and fields |
|
42
|
|
|
|
|
|
|
# * a dump of the stack trace |
|
43
|
2
|
|
|
|
|
6
|
my @summaries = ({ |
|
44
|
|
|
|
|
|
|
filename => "exception-msg.txt", |
|
45
|
|
|
|
|
|
|
mimetype => 'text/plain', |
|
46
|
|
|
|
|
|
|
ident => $ident, |
|
47
|
|
|
|
|
|
|
body => $exception->full_message, |
|
48
|
|
|
|
|
|
|
}); |
|
49
|
|
|
|
|
|
|
|
|
50
|
2
|
50
|
|
|
|
14
|
if (! $exception->NoContextInfo) { |
|
51
|
2
|
|
|
|
|
16
|
my $context = $self->dump({ |
|
52
|
|
|
|
|
|
|
time => $exception->time, |
|
53
|
|
|
|
|
|
|
pid => $exception->pid, |
|
54
|
|
|
|
|
|
|
uid => $exception->uid, |
|
55
|
|
|
|
|
|
|
euid => $exception->euid, |
|
56
|
|
|
|
|
|
|
gid => $exception->gid, |
|
57
|
|
|
|
|
|
|
egid => $exception->egid, |
|
58
|
|
|
|
|
|
|
}, { basename => 'exception-context' }); |
|
59
|
|
|
|
|
|
|
|
|
60
|
2
|
|
|
|
|
11
|
push @summaries, ( |
|
61
|
|
|
|
|
|
|
{ |
|
62
|
|
|
|
|
|
|
filename => "exception-stack.txt", |
|
63
|
|
|
|
|
|
|
mimetype => 'text/plain', |
|
64
|
|
|
|
|
|
|
ident => "stack trace", |
|
65
|
|
|
|
|
|
|
body => $exception->trace->as_string({ |
|
66
|
|
|
|
|
|
|
max_arg_length => 0, |
|
67
|
|
|
|
|
|
|
}), |
|
68
|
|
|
|
|
|
|
}, |
|
69
|
|
|
|
|
|
|
{ |
|
70
|
|
|
|
|
|
|
filename => 'exception-context.txt', |
|
71
|
|
|
|
|
|
|
%$context, |
|
72
|
|
|
|
|
|
|
ident => 'exception context info', |
|
73
|
|
|
|
|
|
|
}, |
|
74
|
|
|
|
|
|
|
); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
2
|
50
|
|
|
|
408
|
if ($exception->Fields) { |
|
78
|
0
|
|
|
|
|
0
|
my $hash = {}; |
|
79
|
0
|
|
|
|
|
0
|
for my $field ($exception->Fields) { |
|
80
|
0
|
|
|
|
|
0
|
$hash->{ $field } = $exception->$field; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
0
|
my $fields = $self->dump($hash, { basename => 'exception-fields' }); |
|
84
|
0
|
|
|
|
|
0
|
push @summaries, { |
|
85
|
|
|
|
|
|
|
filename => "exception-fields.txt", |
|
86
|
|
|
|
|
|
|
%$fields, |
|
87
|
|
|
|
|
|
|
ident => "exception fields", |
|
88
|
|
|
|
|
|
|
}; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
2
|
|
|
|
|
12
|
return @summaries; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |