line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Moose::Role; |
3
|
180
|
|
|
180
|
|
161325
|
use Carp; |
|
180
|
|
|
|
|
639996
|
|
|
180
|
|
|
|
|
1028
|
|
4
|
180
|
|
|
180
|
|
964597
|
use namespace::clean -except => 'meta'; |
|
180
|
|
|
|
|
506
|
|
|
180
|
|
|
|
|
13848
|
|
5
|
180
|
|
|
180
|
|
1341
|
|
|
180
|
|
|
|
|
471
|
|
|
180
|
|
|
|
|
1485
|
|
6
|
|
|
|
|
|
|
with 'Catalyst::Exception::Interface'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has message => ( |
9
|
|
|
|
|
|
|
is => 'ro', |
10
|
|
|
|
|
|
|
isa => 'Str', |
11
|
|
|
|
|
|
|
default => sub { $! || '' }, |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my ($self) = @_; |
15
|
|
|
|
|
|
|
return $self->message; |
16
|
236
|
|
|
236
|
1
|
473
|
} |
17
|
236
|
|
|
|
|
6793
|
|
18
|
|
|
|
|
|
|
around BUILDARGS => sub { |
19
|
|
|
|
|
|
|
my ($next, $class, @args) = @_; |
20
|
|
|
|
|
|
|
if (@args == 1 && !ref $args[0]) { |
21
|
|
|
|
|
|
|
@args = (message => $args[0]); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $args = $class->$next(@args); |
25
|
|
|
|
|
|
|
$args->{message} ||= $args->{error} |
26
|
|
|
|
|
|
|
if exists $args->{error}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return $args; |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $class = shift; |
32
|
|
|
|
|
|
|
my $error = $class->new(@_); |
33
|
|
|
|
|
|
|
local $Carp::CarpLevel = 1; |
34
|
38
|
|
|
38
|
1
|
149
|
croak $error; |
35
|
38
|
|
|
|
|
1238
|
} |
36
|
38
|
|
|
|
|
113
|
|
37
|
38
|
|
|
|
|
1394
|
my ($self) = @_; |
38
|
|
|
|
|
|
|
croak $self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
68
|
|
|
68
|
1
|
168
|
1; |
42
|
68
|
|
|
|
|
1374
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Catalyst::Exception::Basic - Basic Catalyst Exception Role |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SYNOPSIS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
package My::Exception; |
50
|
|
|
|
|
|
|
use Moose; |
51
|
|
|
|
|
|
|
use namespace::clean -except => 'meta'; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
with 'Catalyst::Exception::Basic'; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Elsewhere.. |
56
|
|
|
|
|
|
|
My::Exception->throw( qq/Fatal exception/ ); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
See also L<Catalyst> and L<Catalyst::Exception>. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 DESCRIPTION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This is the basic Catalyst Exception role which implements all of |
63
|
|
|
|
|
|
|
L<Catalyst::Exception::Interface>. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 message |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Holds the exception message. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 METHODS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 as_string |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Stringifies the exception's message attribute. |
76
|
|
|
|
|
|
|
Called when the object is stringified by overloading. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 throw( $message ) |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 throw( message => $message ) |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 throw( error => $error ) |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Throws a fatal exception. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 rethrow( $exception ) |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Rethrows a caught exception. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 meta |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Provided by Moose |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 AUTHORS |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Catalyst Contributors, see Catalyst.pm |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 COPYRIGHT |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This library is free software. You can redistribute it and/or modify |
101
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |