Common/Exception.pm

filter: Statementstmt 93.4% 43 / 46 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 81.8% 9 / 11 Podpod 100% 3 / 3 totaltotal 91.6% 55 / 60 CC 1 SCAR 1.7
CC
1
Cov
93%
as_string
2.0
as_string
2.0
BEGIN
1.0
CRAP 1.2
« Common/WithConfigFile.pm ↑ Summary Common/Types.pm »
1 package Net::Async::Webservice::Common::Exception;
2 2 $Net::Async::Webservice::Common::Exception::VERSION = '1.0.2';
3 {
4 2 $Net::Async::Webservice::Common::Exception::DIST = 'Net-Async-Webservice-Common';
5 }
6 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 with 'Throwable','StackTrace::Auto';
8 use overload
9 2 ▶ q{""} => 'as_string',
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 fallback => 1;
11  
12  
13 2 ▶around _build_stack_trace_args => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
14 2 my ($orig,$self) = @_;
15  
16 2 my $ret = $self->$orig();
17 2 push @$ret, (
18 no_refs => 1,
19 respect_overload => 1,
20 message => '',
21 indent => 1,
22 );
23  
24 2 return $ret;
25 2 };
26  
27  
28 0 ▶sub as_string { "something bad happened at ". $_[0]->stack_trace->as_string }
Subroutine as_string: not called CC=1 SCAR=6.9
Pod documented
29  
30 {
31 package Net::Async::Webservice::Common::Exception::ConfigError;
32 2 $Net::Async::Webservice::Common::Exception::ConfigError::VERSION = '1.0.2';
33 {
34 2 $Net::Async::Webservice::Common::Exception::ConfigError::DIST = 'Net-Async-Webservice-Common';
35 }
36 2 ▶ use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 2 extends 'Net::Async::Webservice::Common::Exception';
38  
39  
40 2 has file => ( is => 'ro', required => 1 );
41  
42  
43 0 ▶ sub as_string {
Subroutine as_string: not called CC=1 SCAR=6.9
Pod documented
44 0 my ($self) = @_;
45  
46 0 return 'Bad config file: %s, at %s',
47 $self->file,
48 $self->stack_trace->as_string;
49 }
50 }
51  
52  
53 {
54 2 package Net::Async::Webservice::Common::Exception::HTTPError;
55 2 $Net::Async::Webservice::Common::Exception::HTTPError::VERSION = '1.0.2';
56 {
57 2 $Net::Async::Webservice::Common::Exception::HTTPError::DIST = 'Net-Async-Webservice-Common';
58 }
59 2 ▶ use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
60 2 extends 'Net::Async::Webservice::Common::Exception';
61 2 ▶ use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
62  
63  
64 2 has request => ( is => 'ro', required => 1 );
65 2 has response => ( is => 'ro', required => 1 );
66 2 has more_info => ( is => 'ro', default => '' );
67  
68  
69 4 ▶ sub as_string {
Subroutine as_string: called CC=1 SCAR=0.0
Pod documented
70 4 my ($self) = @_;
71  
72 return sprintf 'Error %sing %s: %s %s, at %s',
73 $self->request->method,$self->request->uri,
74 4 ▶ (try {$self->response->status_line} catch {'no response'}),
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
75 $self->more_info,
76 $self->stack_trace->as_string;
77 }
78 }
79  
80 2 1;
81  
82 __END__
« Common/WithConfigFile.pm ↑ Summary Common/Types.pm »