Intercom/Exception.pm

filter: Statementstmt 85.8% 73 / 85 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 92.8% 26 / 28 Podpod n/a totaltotal 82.5% 99 / 120 CC 3 SCAR 7.6
CC
3
Cov
81%
__ANON__
12.0
__ANON__
2.0
BEGIN
1.2
CRAP 2.1
« Intercom/User.pm ↑ Summary Intercom/Tag.pm »
1 2 ▶use Moops -strict;
Subroutine __ANON__: called CC=1 SCAR=0.0
2 2 ▶use Throwable ();
Subroutine __ANON__: called CC=1 SCAR=0.0
3 # ABSTRACT: exception class for WebService::Intercom
4  
5 =pod
6  
7 =head1 NAME
8  
9 WebService::Intercom::Exception - represent a exception or error
10  
11 =head1 SYNOPSIS
12  
13 Not useful to create on its own.
14  
15 =head2 ATTRIBUTES
16  
17 =over
18  
19 =item message - the error message
20  
21 =item stack - stack trace of the error.
22  
23 =item code - the code of the error if any
24  
25 =item request_id - the request id of the error if available
26  
27 =back
28  
29 =cut
30 2  
31 2 ▶class WebService::Intercom::Exception with ::Throwable {
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
32 2 ▶ use Devel::StackTrace;
Subroutine BEGIN: called CC=1 SCAR=0.0
33
34 2 my %CarpInternal = ("WebService::Intercom::Exception" => 1,
35 "Throwable" => 1);
36
37 2 has 'code' => (is => 'ro');
38 2 has 'request_id' => (is => 'ro');
39 2 has 'message' => (is => 'ro', isa => 'Maybe[Str]', required => 1);
40 0 ▶ has 'stack' => (is => 'ro', default => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
41 0 my ($level, @caller, %ctxt) = 0;
42 0 ▶ while (
Branch: 1 branch
BranchTrueFalseTotal
if (defined scalar caller $level and $CarpInternal{scalar caller $level}) 0 0 0
Condition0%0/3
defined scalar caller $level and $CarpInternal{scalar caller $level}
!ll&&!rl&&r
000
MC/DC0%0/2
defined scalar caller $level and $CarpInternal{scalar caller $level}
defined scalar caller $level $CarpInternal{scalar caller $level}
Truth table0%0/3
A and B
A= defined scalar caller $levelB= $CarpInternal{scalar caller $level}
ABresult
0X0
100
111
43 defined scalar caller($level) and $CarpInternal{scalar caller($level)}
44 ) {
45 0 $level++;
46 }
47 0 @ctxt{qw/ package file line /} = caller($level);
48
49 0 my $stack = undef;
50
51 0 $stack = "Devel::StackTrace"->new(
52 ignore_package => [ keys %CarpInternal]
53 );
54 0 return $stack;
55 2 });
56
57 2 ▶ use overload fallback => 1,
Subroutine BEGIN: called CC=1 SCAR=2.2
58 0 ▶ '""' => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 my $e = shift;
60 0 my $msg = "WebService::Intercom::Exception: @{[$e->message]}\n";
61 0 $msg .= "Stack: " . $e->stack . "\n";
62 0 return $msg;
63 2 };
64 }
65  
66
67 2 1;
68  
« Intercom/User.pm ↑ Summary Intercom/Tag.pm »