Error/Server.pm

filter: Statementstmt 100% 43 / 43 Branchbran 100% 12 / 12 Conditioncond 72.7% 8 / 11 MC/DCmcdc 14.2% 1 / 7 Subroutinesub 100% 14 / 14 Podpod 100% 7 / 7 totaltotal 90.4% 85 / 94 CC 11 SCAR 8.1
CC
11
Cov
95%
code
4.0
message
3.0
_parse_code
3.0
CRAP 2.3
« Error.pm ↑ Summary Error/Internal.pm »
1 2 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Neo4j::Error::Server;
6 # ABSTRACT: Neo4j exception thrown by the Neo4j server
7 2 $Neo4j::Error::Server::VERSION = '0.02';
8  
9 2 ▶use parent 'Neo4j::Error';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶use List::Util 1.33 qw(all);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13  
14 4 ▶sub source { 'Server' }
Subroutine source: called CC=1 SCAR=0.0
Pod documented
15  
16  
17 28 ▶sub message {
Subroutine message: called CC=3 SCAR=11.0
Pod documented
18 28 my ($self) = @_;
19
20 # Decode "strict" Jolt format if necessary
21 28 ▶ $self->{message} = $self->{message}{U} if ref $self->{message} eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->{"message"} eq "HASH" 1 27 28
22
23 28 ▶ return $self->{message} // '';
Condition100%2/2
$self->{"message"} // ""
l!l
1018
MC/DC100%1/1
$self->{"message"} // ""
$self->{"message"}
Truth table100%2/2
A
A= $self->{"message"}
Aresult
11
00
24 }
25  
26  
27 39 ▶sub code {
Subroutine code: called CC=4 SCAR=13.9
Pod documented
28 39 my ($self) = @_;
29
30 # Decode "strict" Jolt format if necessary
31 39 ▶ $self->{code} = $self->{code}{U} if ref $self->{code} eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->{"code"} eq "HASH" 1 38 39
32
33 39 ▶ return $self->{code} if defined $self->{code};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"code"} 32 7 39
34
35 my @parts = (
36 'Neo',
37 $self->{classification},
38 $self->{category},
39 $self->{title},
40 7 );
41 7 ▶ return '' unless all { defined } @parts;
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
unless &all(sub { defined $_; } , @parts) 6 1 7
42 1 return $self->{code} = join '.', @parts;
43 }
44  
45  
46 12 ▶sub _parse_code {
Subroutine _parse_code: called CC=3 SCAR=11.0
47 12 my ($self, $part) = @_;
48
49 12 ▶ return '' unless defined $self->{code};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"code"} 1 11 12
50 11 my @parts = $self->code =~ m/^Neo\.([^\.]+)\.([^\.]+)\.(.+)$/i;
51 11 ▶ return '' unless @parts;
Branch: 1 branch
BranchTrueFalseTotal
unless @parts 3 8 11
52
53 8 $self->{classification} = $parts[0];
54 8 $self->{category} = $parts[1];
55 8 $self->{title} = $parts[2];
56 8 return $self->{$part};
57 }
58  
59  
60 11 ▶sub classification {
Subroutine classification: called CC=2 SCAR=7.1
Pod documented
61 11 my ($self) = @_;
62
63 11 ▶ return $self->{classification} // $self->_parse_code('classification');
Condition66%2/3
$self->{"classification"} // $self->_parse_code("classification")
l!l&&r!l&&!r
470
MC/DC0%0/2
$self->{"classification"} // $self->_parse_code("classification")
$self->{"classification"} $self->_parse_code("classification")
Truth table66%2/3
A // B
A= $self->{"classification"}B= $self->_parse_code("classification")
ABresult
1X1
011
000
64 }
65  
66  
67 7 ▶sub category {
Subroutine category: called CC=2 SCAR=7.1
Pod documented
68 7 my ($self) = @_;
69
70 7 ▶ return $self->{category} // $self->_parse_code('category');
Condition66%2/3
$self->{"category"} // $self->_parse_code("category")
l!l&&r!l&&!r
430
MC/DC0%0/2
$self->{"category"} // $self->_parse_code("category")
$self->{"category"} $self->_parse_code("category")
Truth table66%2/3
A // B
A= $self->{"category"}B= $self->_parse_code("category")
ABresult
1X1
011
000
71 }
72  
73  
74 7 ▶sub title {
Subroutine title: called CC=2 SCAR=7.1
Pod documented
75 7 my ($self) = @_;
76
77 7 ▶ return $self->{title} // $self->_parse_code('title');
Condition66%2/3
$self->{"title"} // $self->_parse_code("title")
l!l&&r!l&&!r
520
MC/DC0%0/2
$self->{"title"} // $self->_parse_code("title")
$self->{"title"} $self->_parse_code("title")
Truth table66%2/3
A // B
A= $self->{"title"}B= $self->_parse_code("title")
ABresult
1X1
011
000
78 }
79  
80  
81 4 ▶sub is_retryable {
Subroutine is_retryable: called CC=1 SCAR=0.0
Pod documented
82 4 my ($self) = @_;
83
84 4 return $self->classification eq 'TransientError';
85 }
86  
87  
88 2 1;
« Error.pm ↑ Summary Error/Internal.pm »