line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Event::Exception; |
2
|
246
|
|
|
246
|
|
2173
|
use strict; |
|
246
|
|
|
|
|
533
|
|
|
246
|
|
|
|
|
7250
|
|
3
|
246
|
|
|
246
|
|
1318
|
use warnings; |
|
246
|
|
|
|
|
505
|
|
|
246
|
|
|
|
|
13919
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.302182'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
246
|
|
|
246
|
|
1485
|
BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } |
|
246
|
|
|
|
|
10857
|
|
9
|
246
|
|
|
246
|
|
1737
|
use Test2::Util::HashBase qw{error}; |
|
246
|
|
|
|
|
585
|
|
|
246
|
|
|
|
|
1740
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub init { |
12
|
2
|
|
|
2
|
0
|
5
|
my $self = shift; |
13
|
2
|
|
|
|
|
11
|
$self->{+ERROR} = "$self->{+ERROR}"; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
1
|
20
|
sub causes_fail { 1 } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub summary { |
19
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
20
|
1
|
|
|
|
|
5
|
chomp(my $msg = "Exception: " . $self->{+ERROR}); |
21
|
1
|
|
|
|
|
6
|
return $msg; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
1
|
4
|
sub diagnostics { 1 } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub facet_data { |
27
|
2
|
|
|
2
|
1
|
6
|
my $self = shift; |
28
|
2
|
|
|
|
|
14
|
my $out = $self->common_facet_data; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$out->{errors} = [ |
31
|
|
|
|
|
|
|
{ |
32
|
|
|
|
|
|
|
tag => 'ERROR', |
33
|
|
|
|
|
|
|
fail => 1, |
34
|
2
|
|
|
|
|
9
|
details => $self->{+ERROR}, |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
]; |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
8
|
return $out; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=pod |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=encoding UTF-8 |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Test2::Event::Exception - Exception event |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
An exception event will display to STDERR, and will prevent the overall test |
57
|
|
|
|
|
|
|
file from passing. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SYNOPSIS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
use Test2::API qw/context/; |
62
|
|
|
|
|
|
|
use Test2::Event::Exception; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $ctx = context(); |
65
|
|
|
|
|
|
|
my $event = $ctx->send_event('Exception', error => 'Stuff is broken'); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 METHODS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Inherits from L<Test2::Event>. Also defines: |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=over 4 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item $reason = $e->error |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The reason for the exception. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=back |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 CAVEATS |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Be aware that all exceptions are stringified during construction. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 SOURCE |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
The source code repository for Test2 can be found at |
86
|
|
|
|
|
|
|
F<http://github.com/Test-More/test-more/>. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 MAINTAINERS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=over 4 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item Chad Granum E<lt>exodist@cpan.orgE<gt> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=back |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 AUTHORS |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over 4 |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item Chad Granum E<lt>exodist@cpan.orgE<gt> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=back |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Copyright 2020 Chad Granum E<lt>exodist@cpan.orgE<gt>. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
109
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
See F<http://dev.perl.org/licenses/> |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |