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 69     69   185223 use strict;
  69         227  
  69         3306  
4 69     69   499 use warnings;
  69         207  
  69         4096  
5 69     69   1132 use 5.018;
  69         251  
6              
7             our $VERSION = '0.001';
8              
9             use overload
10             '""' => 'stringify',
11 143     143   1990 bool => sub { 1 },
12 69     69   453 fallback => 1;
  69         134  
  69         963  
13              
14             sub new {
15 86     86 0 270702 my ($class, %args) = @_;
16 86         4142 return bless \%args, $class;
17             }
18              
19 75     75 0 1506 sub message { shift->{message} }
20              
21             sub stringify {
22 72     72 0 1506 my ($self) = @_;
23 72   33     631 return $self->message // ref($self) . ' error';
24             }
25              
26             sub throw {
27 1     1 0 1729 my $self = shift;
28 1 50       5 $self = $self->new(@_) unless ref $self;
29 1         4 die $self;
30             }
31              
32             1;
33              
34             __END__