Docker/Error/HTTP.pm

filter: Statementstmt 95.6% 22 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 100% 1 / 1 totaltotal 93.9% 31 / 33 CC 1 SCAR 1.1
CC
1
Cov
96%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Docker/Error/Stream.pm ↑ Summary Docker/Config.pm »
1 package API::Docker::Error::HTTP;
2 # ABSTRACT: Error status returned by the Docker Engine on the status line
3 53 our $VERSION = '0.006';
4 53 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 # namespace::clean has to come BEFORE "use overload" here, not after it as
6 # everywhere else in this distribution -- same reason as in
7 # API::Docker::Error::Stream. It sweeps the symbols `overload` installs --
8 # the `("" ` slot among them -- so with the two lines in the house order the
9 # class ends up not overloaded at all and stringifies as
10 # API::Docker::Error::HTTP=HASH(0x...). Nothing dies when that happens: every
11 # caller that only inspects $@ as a string silently starts seeing a reference
12 # address instead of the reason, and this is the exception every resource
13 # method in the distribution can raise. Measured, not assumed:
14 # overload::Overloaded($err) is false with the lines swapped.
15 53 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 use overload
17 34 ▶ '""' => sub { $_[0]->as_string },
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
18 2 ▶ 'bool' => sub { 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
19 53 fallback => 1;
20  
21  
22 53 has message => (
23 is => 'ro',
24 required => 1,
25 );
26  
27  
28 has location => (
29 is => 'ro',
30 0 ▶ default => sub { '' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
31 53 );
32  
33  
34 53 has status => (
35 is => 'ro',
36 required => 1,
37 );
38  
39  
40 has reason => (
41 is => 'ro',
42 3 ▶ default => sub { '' },
Subroutine __ANON__: called CC=1 SCAR=0.0
43 53 );
44  
45  
46 has body => (
47 is => 'ro',
48 3 ▶ default => sub { '' },
Subroutine __ANON__: called CC=1 SCAR=0.0
49 53 );
50  
51  
52 53 has data => (
53 is => 'ro',
54 );
55  
56  
57 34 ▶sub as_string { $_[0]->message . $_[0]->location }
Subroutine as_string: called CC=1 SCAR=0.0
Pod documented
58  
59  
60  
61 53 1;
62  
63 __END__
« Docker/Error/Stream.pm ↑ Summary Docker/Config.pm »