API/Error.pm

filter: Statementstmt 95.2% 20 / 21 Branchbran n/a Conditioncond 42.8% 3 / 7 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 1 totaltotal 76.3% 29 / 38 CC 4 SCAR 10.2
CC
4
Cov
82%
error
5.4
__ANON__
1.1
BEGIN
1.0
CRAP 2.8
« API/Role/Serialization.pm ↑ Summary API/Meta/Method/APIMethod.pm »
1 package Net::HTTP::API::Error;
2 5 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 $Net::HTTP::API::Error::VERSION = '0.14';
4 }
5  
6 # ABSTRACT: Throw error
7  
8 5 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 ▶use overload '""' => \&error;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 5 subtype error => as 'Str';
14 0 ▶coerce error => from 'HashRef' => via { JSON::encode_json $_};
Subroutine __ANON__: not called CC=1 SCAR=1.2
15  
16 5 has http_error => (
17 is => 'ro',
18 isa => 'HTTP::Response',
19 handles => { http_message => 'message', http_code => 'code' }
20 );
21 5 has reason => (
22 is => 'ro',
23 isa => 'error',
24 predicate => 'has_reason',
25 coerce => 1
26 );
27  
28 1 ▶sub error {
Subroutine error: called CC=4 SCAR=16.9
Pod undocumented
29 1 my $self = shift;
30 return
31 1 ▶ ( $self->has_reason && $self->reason )
Condition42%3/7
$self->has_reason && $self->reason || $self->http_message . ': ' . $self->http_code || 'unknown'
l!l
10
$self->has_reason and $self->reason or $self->http_message . ': ' . $self->http_code
l!l
10
$self->has_reason and $self->reason
!ll&&!rl&&r
001
MC/DC0%0/2
$self->has_reason && $self->reason || $self->http_message . ': ' . $self->http_code || 'unknown'
$self->has_reason $self->reason
Truth table33%1/3
A and B
A= $self->has_reasonB= $self->reason
ABresult
111
0X0
100
32 || ( $self->http_message . ": " . $self->http_code )
33 || 'unknown';
34 }
35  
36 5 1;
37  
38  
39 __END__
« API/Role/Serialization.pm ↑ Summary API/Meta/Method/APIMethod.pm »