line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Opsview::REST::Exception; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Opsview::REST::Exception::VERSION = '0.013'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
9
|
|
50
|
use Moo; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
61
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use overload |
9
|
|
|
|
|
|
|
'""' => sub { |
10
|
0
|
|
|
0
|
|
|
my $error = join (' ', $_[0]->status, $_[0]->reason); |
11
|
0
|
0
|
|
|
|
|
my $msg = $_[0]->message; chomp $msg if $msg; |
|
0
|
|
|
|
|
|
|
12
|
0
|
0
|
|
|
|
|
my $dtl = $_[0]->detail; chomp $dtl if $dtl; |
|
0
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
0
|
0
|
|
|
|
|
$error = join ': ', $error, $msg if ($msg); |
15
|
0
|
0
|
|
|
|
|
$error = join '; ', $error, $dtl if ($dtl); |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
return "$error\n"; |
18
|
|
|
|
|
|
|
}, |
19
|
9
|
|
|
9
|
|
7150
|
fallback => 1; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
3054
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has [qw/status reason/] => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
required => 1, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has [qw/message detail/] => ( |
28
|
|
|
|
|
|
|
is => 'ro', |
29
|
|
|
|
|
|
|
required => 0, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |