File Coverage

blib/lib/Async/Redis/Error.pm
Criterion Covered Total %
statement 20 20 100.0
branch 1 2 50.0
condition 1 3 33.3
subroutine 9 9 100.0
pod 0 4 0.0
total 31 38 81.5


line stmt bran cond sub pod time code
1             package Async::Redis::Error;
2              
3 74     74   271339 use strict;
  74         228  
  74         3448  
4 74     74   443 use warnings;
  74         196  
  74         4176  
5 74     74   1255 use 5.018;
  74         258  
6              
7             our $VERSION = '0.001';
8              
9             use overload
10             '""' => 'stringify',
11 156     156   3325 bool => sub { 1 },
12 74     74   463 fallback => 1;
  74         147  
  74         906  
13              
14             sub new {
15 91     91 0 217282 my ($class, %args) = @_;
16 91         4569 return bless \%args, $class;
17             }
18              
19 81     81 0 2703 sub message { shift->{message} }
20              
21             sub stringify {
22 78     78 0 1442 my ($self) = @_;
23 78   33     687 return $self->message // ref($self) . ' error';
24             }
25              
26             sub throw {
27 1     1 0 3229 my $self = shift;
28 1 50       9 $self = $self->new(@_) unless ref $self;
29 1         7 die $self;
30             }
31              
32             1;
33              
34             __END__