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 76     76   218279 use strict;
  76         158  
  76         2502  
4 76     76   277 use warnings;
  76         112  
  76         3115  
5 76     76   896 use 5.018;
  76         201  
6              
7             our $VERSION = '0.001';
8              
9             use overload
10             '""' => 'stringify',
11 164     164   2476 bool => sub { 1 },
12 76     76   324 fallback => 1;
  76         115  
  76         746  
13              
14             sub new {
15 94     94 0 185356 my ($class, %args) = @_;
16 94         3403 return bless \%args, $class;
17             }
18              
19 83     83 0 1433 sub message { shift->{message} }
20              
21             sub stringify {
22 80     80 0 1026 my ($self) = @_;
23 80   33     821 return $self->message // ref($self) . ' error';
24             }
25              
26             sub throw {
27 1     1 0 1657 my $self = shift;
28 1 50       5 $self = $self->new(@_) unless ref $self;
29 1         5 die $self;
30             }
31              
32             1;
33              
34             __END__