blib/lib/WebDyne/Cloudflare/Hyperdrive/Error.pm

filter: Statementstmt 94.1% 32 / 34 Branchbran 100% 2 / 2 Conditioncond 69.2% 9 / 13 MC/DCmcdc 42.8% 3 / 7 Subroutinesub 87.5% 14 / 16 Podpod 0.0% 0 / 12 totaltotal 71.4% 60 / 84 CC 8 SCAR 7.4
CC
8
Cov
88%
as_string
4.2
with_cleanup
3.0
cleanup_errors
2.1
CRAP 2.1
« blib/lib/WebDyne/Cloudflare/SecretsStore/Error.pm ↑ Summary blib/lib/WebDyne/Cloudflare/DurableObject/Handler.pm »
1 package WebDyne::Cloudflare::Hyperdrive::Error;
2  
3 2 ▶use 5.020;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use overload '""' => 'as_string', fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 our $VERSION='0.001';
9  
10 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
11 6 my ($class, %opt)=@_;
12 6 return bless({ %opt }, $class);
13 }
14  
15  
16 1 ▶sub code { return shift()->{'code'}; }
Subroutine code: called CC=1 SCAR=0.0
Pod undocumented
17 1 ▶sub sqlstate { return shift()->{'sqlstate'}; }
Subroutine sqlstate: called CC=1 SCAR=0.0
Pod undocumented
18 1 ▶sub errno { return shift()->{'errno'}; }
Subroutine errno: called CC=1 SCAR=0.0
Pod undocumented
19 0 ▶sub message { return shift()->{'message'}; }
Subroutine message: not called CC=1 SCAR=6.9
Pod undocumented
20 0 ▶sub name { return shift()->{'name'}; }
Subroutine name: not called CC=1 SCAR=6.9
Pod undocumented
21 5 ▶sub outcome_unknown { return shift()->{'outcomeUnknown'}||0; }
Subroutine outcome_unknown: called CC=2 SCAR=6.9
Pod undocumented
Condition100%2/2
+(shift())->{'outcomeUnknown'} || 0
l!l
32
MC/DC100%1/1
+(shift())->{'outcomeUnknown'} || 0
+(shift())->{'outcomeUnknown'}
Truth table100%2/2
A
A= +(shift())->{'outcomeUnknown'}
Aresult
11
00
22 1 ▶sub details { return { %{$_[0]} }; }
Subroutine details: called CC=1 SCAR=0.0
Pod undocumented
23 1 ▶sub cause { return shift()->{'cause'}; }
Subroutine cause: called CC=1 SCAR=0.0
Pod undocumented
24 2 ▶sub cleanup_errors { return [@{$_[0]->{'cleanup_errors'}||[]}]; }
Subroutine cleanup_errors: called CC=2 SCAR=7.2
Pod undocumented
Condition50%1/2
$_[0]{'cleanup_errors'} || []
l!l
20
MC/DC0%0/1
$_[0]{'cleanup_errors'} || []
$_[0]{'cleanup_errors'}
Truth table50%1/2
A
A= $_[0]{'cleanup_errors'}
Aresult
11
00
25  
26  
27 2 ▶sub with_cleanup {
Subroutine with_cleanup: called CC=3 SCAR=11.0
Pod undocumented
28 2 my ($class, $primary_ref, $cleanup_ref)=@_;
29 2 require Scalar::Util;
30 2 ▶ my $error_or=(Scalar::Util::blessed($primary_ref)&&$primary_ref->isa($class))
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($primary_ref) && $primary_ref->isa($class) ? : 1 1 2
Condition66%2/3
builtin::blessed($primary_ref) and $primary_ref->isa($class)
!ll&&!rl&&r
101
MC/DC50%1/2
builtin::blessed($primary_ref) and $primary_ref->isa($class)
builtin::blessed($primary_ref) $primary_ref->isa($class)
Truth table66%2/3
A and B
A= builtin::blessed($primary_ref)B= $primary_ref->isa($class)
ABresult
0X0
100
111
31 ? $primary_ref : $class->new(name => 'TRANSACTION_ERROR', code => 'CALLBACK_FAILED',
32 message => "$primary_ref", cause => $primary_ref);
33 2 push(@{$error_or->{'cleanup_errors'}}, $cleanup_ref);
34 2 return $error_or;
35 }
36  
37  
38 26 ▶sub as_string {
Subroutine as_string: called CC=4 SCAR=14.5
Pod undocumented
39 26 my ($self)=@_;
40 return ($self->{'name'}||'HYPERDRIVE_ERROR') . ' [' .
41 26 ▶ ($self->{'code'}||'UNKNOWN') . ']: ' . ($self->{'message'}||'Request failed');
Condition66%4/6
$self->{'name'} || 'HYPERDRIVE_ERROR'
l!l
422
$self->{'code'} || 'UNKNOWN'
l!l
260
$self->{'message'} || 'Request failed'
l!l
260
MC/DC100%1/1
$self->{'name'} || 'HYPERDRIVE_ERROR'
$self->{'name'}
MC/DC0%0/1
$self->{'code'} || 'UNKNOWN'
$self->{'code'}
MC/DC0%0/1
$self->{'message'} || 'Request failed'
$self->{'message'}
Truth table100%2/2
A
A= $self->{'name'}
Aresult
11
00
Truth table50%1/2
A
A= $self->{'code'}
Aresult
11
00
Truth table50%1/2
A
A= $self->{'message'}
Aresult
11
00
42 }
43  
44 2 1;
« blib/lib/WebDyne/Cloudflare/SecretsStore/Error.pm ↑ Summary blib/lib/WebDyne/Cloudflare/DurableObject/Handler.pm »