WiX3/Exceptions.pm untested

filter: Statementstmt 0.0% 0 / 76 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 109 CC 3 SCAR 11.0
CC
3
Cov
0%
WiX3::Exception::full_message
6.0
WiX3::Exception::Caught::full_message
6.0
WiX3::Exception::Unimplemented::full_message
2.0
CRAP 3.0
1 package WiX3::Exceptions;
2  
3 use 5.008003;
4 use strict;
5 use warnings;
6  
7 our $VERSION = '0.011';
8  
9 use Exception::Class 1.29 (
10 'WiX3::Exception' => {
11 'description' => 'WiX3 error',
12 'fields' => [qw(message longmess)],
13 },
14 'WiX3::Exception::Unimplemented' => {
15 'description' => 'Routine unimplemented',
16 'isa' => 'WiX3::Exception',
17 },
18 'WiX3::Exception::Parameter' => {
19 'description' => 'Parameter missing or invalid',
20 'isa' => 'WiX3::Exception',
21 },
22 'WiX3::Exception::Parameter::Missing' => {
23 'description' => 'Parameter missing',
24 'isa' => 'WiX3::Exception::Parameter',
25 },
26 'WiX3::Exception::Parameter::Invalid' => {
27 'description' => 'Parameter invalid',
28 'isa' => 'WiX3::Exception::Parameter',
29 },
30 'WiX3::Exception::Parameter::Odd' => {
31 'description' => 'Odd number of parameters when pairs required',
32 'isa' => 'WiX3::Exception::Parameter',
33 },
34 'WiX3::Exception::Parameter::Validation' => {
35 'description' => 'Validation error',
36 'isa' => 'WiX3::Exception::Parameter',
37 'fields' => [qw(attribute type value)],
38 },
39 'WiX3::Exception::Caught' => {
40 'description' => 'Error caught by WiX3 from other module',
41 'isa' => 'WiX3::Exception',
42 'fields' => [qw(message info longmess)],
43 },
44  
45 );
46  
47 #sub WiX3::Exception::as_string {
48 # return q{};
49 #}
50  
51 sub WiX3::Exception::full_message {
52 my $self = shift;
53  
54 my $string =
55 $self->description() . ': '
56 . $self->message() . "\n"
57 . ' Time error caught: '
58 . localtime() . "\n";
59 require WiX3::Traceable;
60 my $misc = WiX3::Traceable->new();
61 my $tracelevel = $misc->get_tracelevel();
62  
63 # Add trace to it if tracelevel high enough.
64 if ( ( $tracelevel > 1 ) or ( $self->longmess() ) ) {
65 $string .= "\n" . $self->trace() . "\n";
66 }
67  
68 $misc->trace_line( 0, $string );
69  
70 return $string;
71 } ## end sub WiX3::Exception::full_message
72  
73 sub WiX3::Exception::Unimplemented::full_message {
74 my $self = shift;
75  
76 my $string =
77 'WiX3 error: '
78 . $self->description() . q{: }
79 . $self->message() . "\n"
80 . ' Time error caught: '
81 . localtime() . "\n";
82 require WiX3::Traceable;
83 my $misc = WiX3::Traceable->new();
84  
85 # Add trace to it.
86 $string .= "\n" . $self->trace() . "\n";
87  
88 $misc->trace_line( 0, $string );
89  
90 return $string;
91 } ## end sub WiX3::Exception::Unimplemented::full_message
92  
93 sub WiX3::Exception::Parameter::full_message {
94 my $self = shift;
95  
96 my $string =
97 'WiX3 error: '
98 . $self->description() . ': '
99 . $self->message() . "\n"
100 . 'Time error caught: '
101 . localtime() . "\n";
102 require WiX3::Traceable;
103 my $misc = WiX3::Traceable->new();
104  
105 # Add trace to it. (We automatically dump trace for parameter errors.)
106 $string .= "\n" . $self->trace() . "\n";
107  
108 $misc->trace_line( 0, $string );
109  
110 return $string;
111 } ## end sub WiX3::Exception::Parameter::full_message
112  
113 sub WiX3::Exception::Parameter::Validation::full_message {
114 my $self = shift;
115  
116 my $string =
117 'WiX3 error: '
118 . $self->description()
119 . qq{:\n '}
120 . $self->attribute()
121 . q{' not }
122 . $self->type()
123 . q{ (value passed in: '}
124 . $self->value
125 . qq{')\n}
126 . ' Time error caught: '
127 . localtime() . "\n";
128 require WiX3::Traceable;
129 my $misc = WiX3::Traceable->new();
130  
131 # Add trace to it. (We automatically dump trace for parameter errors.)
132 $string .= "\n" . $self->trace() . "\n";
133  
134 $misc->trace_line( 0, $string );
135  
136 return $string;
137 } ## end sub WiX3::Exception::Parameter::Validation::full_message
138  
139  
140  
141 sub WiX3::Exception::Caught::full_message {
142 my $self = shift;
143  
144 my $string =
145 'WiX3 error: '
146 . $self->description() . ': '
147 . $self->message() . "\n"
148 . $self->info() . "\n"
149 . ' Time error caught: '
150 . localtime() . "\n";
151 require WiX3::Traceable;
152 my $misc = WiX3::Traceable->new();
153 my $tracelevel = $misc->get_tracelevel();
154  
155 # Add trace to it if tracelevel high enough.
156 if ( ( $tracelevel > 1 ) or ( $self->longmess() ) ) {
157 $string .= "\n" . $self->trace() . "\n";
158 }
159  
160 $misc->trace_line( 0, $string );
161  
162 return $string;
163 } ## end sub WiX3::Exception::Caught::full_message
164  
165 1;
166  
167 __END__