line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Async::Webservice::Common::Exception; |
2
|
|
|
|
|
|
|
$Net::Async::Webservice::Common::Exception::VERSION = '1.0.2'; |
3
|
|
|
|
|
|
|
{ |
4
|
|
|
|
|
|
|
$Net::Async::Webservice::Common::Exception::DIST = 'Net-Async-Webservice-Common'; |
5
|
|
|
|
|
|
|
} |
6
|
2
|
|
|
2
|
|
19
|
use Moo; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
29
|
|
7
|
|
|
|
|
|
|
with 'Throwable','StackTrace::Auto'; |
8
|
|
|
|
|
|
|
use overload |
9
|
2
|
|
|
|
|
33
|
q{""} => 'as_string', |
10
|
2
|
|
|
2
|
|
1417
|
fallback => 1; |
|
2
|
|
|
|
|
5
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
around _build_stack_trace_args => sub { |
14
|
|
|
|
|
|
|
my ($orig,$self) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $ret = $self->$orig(); |
17
|
|
|
|
|
|
|
push @$ret, ( |
18
|
|
|
|
|
|
|
no_refs => 1, |
19
|
|
|
|
|
|
|
respect_overload => 1, |
20
|
|
|
|
|
|
|
message => '', |
21
|
|
|
|
|
|
|
indent => 1, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
return $ret; |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
0
|
1
|
0
|
sub as_string { "something bad happened at ". $_[0]->stack_trace->as_string } |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
{ |
31
|
|
|
|
|
|
|
package Net::Async::Webservice::Common::Exception::ConfigError; |
32
|
|
|
|
|
|
|
$Net::Async::Webservice::Common::Exception::ConfigError::VERSION = '1.0.2'; |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
$Net::Async::Webservice::Common::Exception::ConfigError::DIST = 'Net-Async-Webservice-Common'; |
35
|
|
|
|
|
|
|
} |
36
|
2
|
|
|
2
|
|
787
|
use Moo; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
15
|
|
37
|
|
|
|
|
|
|
extends 'Net::Async::Webservice::Common::Exception'; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has file => ( is => 'ro', required => 1 ); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub as_string { |
44
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
return 'Bad config file: %s, at %s', |
47
|
|
|
|
|
|
|
$self->file, |
48
|
|
|
|
|
|
|
$self->stack_trace->as_string; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
{ |
54
|
|
|
|
|
|
|
package Net::Async::Webservice::Common::Exception::HTTPError; |
55
|
|
|
|
|
|
|
$Net::Async::Webservice::Common::Exception::HTTPError::VERSION = '1.0.2'; |
56
|
|
|
|
|
|
|
{ |
57
|
|
|
|
|
|
|
$Net::Async::Webservice::Common::Exception::HTTPError::DIST = 'Net-Async-Webservice-Common'; |
58
|
|
|
|
|
|
|
} |
59
|
2
|
|
|
2
|
|
2040
|
use Moo; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
13
|
|
60
|
|
|
|
|
|
|
extends 'Net::Async::Webservice::Common::Exception'; |
61
|
2
|
|
|
2
|
|
2894
|
use Try::Tiny; |
|
2
|
|
|
|
|
2566
|
|
|
2
|
|
|
|
|
634
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
has request => ( is => 'ro', required => 1 ); |
65
|
|
|
|
|
|
|
has response => ( is => 'ro', required => 1 ); |
66
|
|
|
|
|
|
|
has more_info => ( is => 'ro', default => '' ); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub as_string { |
70
|
4
|
|
|
4
|
1
|
11846
|
my ($self) = @_; |
71
|
|
|
|
|
|
|
|
72
|
4
|
|
|
4
|
|
536
|
return sprintf 'Error %sing %s: %s %s, at %s', |
73
|
|
|
|
|
|
|
$self->request->method,$self->request->uri, |
74
|
4
|
|
|
2
|
|
31
|
(try {$self->response->status_line} catch {'no response'}), |
|
2
|
|
|
|
|
39
|
|
75
|
|
|
|
|
|
|
$self->more_info, |
76
|
|
|
|
|
|
|
$self->stack_trace->as_string; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=pod |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=encoding UTF-8 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 NAME |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Net::Async::Webservice::Common::Exception |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 VERSION |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
version 1.0.2 |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 DESCRIPTION |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
These classes are based on L<Throwable> and L<StackTrace::Auto>. The |
99
|
|
|
|
|
|
|
L</as_string> method should return something readable, with a full |
100
|
|
|
|
|
|
|
stack trace. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 NAME |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Net::Async::Webservice::Common::Exception - exception classes |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 Classes |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 C<Net::Async::Webservice::Common::Exception> |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Base class. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head3 Methods |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head4 C<as_string> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Generic "something bad happened", with stack trace. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 C<Net::Async::Webservice::Common::Exception::ConfigError> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
exception thrown when the configuration file can't be parsed |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head3 Attributes |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head4 C<file> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The name of the configuration file. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head3 Methods |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head4 C<as_string> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Mentions the file name, and gives the stack trace. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 C<Net::Async::Webservice::Common::Exception::HTTPError> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
exception thrown when the HTTP request fails |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head3 Attributes |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head4 C<request> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
The request that failed. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head4 C<response> |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
The failure response returned by the user agent |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head4 C<more_info> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Additional error information, usually set when there is no response at |
151
|
|
|
|
|
|
|
all (failures in name lookup or connection, for example). |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head3 Methods |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head4 C<as_string> |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Mentions the HTTP method, URL, response status line, and stack trace. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 AUTHOR |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com> |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Net-a-porter.com. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
168
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |