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 92     92   172816 use strict;
  92         154  
  92         2883  
4 92     92   390 use warnings;
  92         131  
  92         3713  
5 92     92   1062 use 5.018;
  92         232  
6              
7             use overload
8             '""' => 'stringify',
9 221     221   2676 bool => sub { 1 },
10 92     92   354 fallback => 1;
  92         120  
  92         888  
11              
12             sub new {
13 119     119 0 157719 my ($class, %args) = @_;
14 119         3279 return bless \%args, $class;
15             }
16              
17 96     96 0 1492 sub message { shift->{message} }
18              
19             sub stringify {
20 93     93 0 2709 my ($self) = @_;
21 93   33     449 return $self->message // ref($self) . ' error';
22             }
23              
24             sub throw {
25 1     1 0 1708 my $self = shift;
26 1 50       24 $self = $self->new(@_) unless ref $self;
27 1         5 die $self;
28             }
29              
30             1;
31              
32             __END__