line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Client Exception Class |
2
|
|
|
|
|
|
|
package API::Client::Exception; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use Data::Object::Class; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
5
|
1
|
|
|
1
|
|
304
|
use Data::Object::Signatures; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
|
|
5
|
use Data::Object::Library qw( |
8
|
|
|
|
|
|
|
InstanceOf |
9
|
|
|
|
|
|
|
Int |
10
|
|
|
|
|
|
|
Maybe |
11
|
|
|
|
|
|
|
Str |
12
|
1
|
|
|
1
|
|
8564
|
); |
|
1
|
|
|
|
|
3
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
extends 'Data::Object::Exception'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.03'; # VERSION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# ATTRIBUTES |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has code => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => Maybe[Int], |
23
|
|
|
|
|
|
|
required => 0, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has method => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => Str, |
29
|
|
|
|
|
|
|
required => 1, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has tx => ( |
33
|
|
|
|
|
|
|
is => 'ro', |
34
|
|
|
|
|
|
|
isa => InstanceOf['Mojo::Transaction'], |
35
|
|
|
|
|
|
|
required => 1, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has url => ( |
39
|
|
|
|
|
|
|
is => 'ro', |
40
|
|
|
|
|
|
|
isa => InstanceOf['Mojo::URL'], |
41
|
|
|
|
|
|
|
required => 1, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has '+message' => ( |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
isa => Str, |
47
|
|
|
|
|
|
|
required => 0, |
48
|
|
|
|
|
|
|
lazy => 1, |
49
|
|
|
|
|
|
|
builder => 'default_message', |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# METHODS |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
0
|
|
method default_message { |
|
0
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $code = $self->code; |
57
|
0
|
|
|
|
|
|
my $method = $self->method; |
58
|
0
|
|
|
|
|
|
my $url = $self->url; |
59
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
my $reason = $code ? "response code $code" : "unexpected response"; |
61
|
0
|
|
|
|
|
|
my $message = "$reason received while processing the request $method $url"; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return $message; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |