File Coverage

blib/lib/Spike/Error.pm
Criterion Covered Total %
statement 18 25 72.0
branch 0 2 0.0
condition 0 6 0.0
subroutine 6 9 66.6
pod 0 2 0.0
total 24 44 54.5


line stmt bran cond sub pod time code
1             package Spike::Error;
2              
3 1     1   3 use strict;
  1         1  
  1         23  
4 1     1   3 use warnings;
  1         1  
  1         20  
5              
6 1     1   2 use base qw(Spike::Object);
  1         1  
  1         126  
7              
8 0 0   0 0   sub throw { die ref $_[0] ? $_[0] : shift->new(@_) }
9              
10             sub new {
11 0     0 0   my ($proto, $text, $value) = splice @_, 0, 3;
12 0   0       my $class = ref $proto || $proto;
13              
14 0           return $class->SUPER::new(@_, text => $text, value => $value);
15             }
16              
17             __PACKAGE__->mk_ro_accessors(qw(text value));
18              
19             package Spike::Error::HTTP;
20              
21 1     1   4 use base qw(Spike::Error);
  1         1  
  1         43  
22              
23 1     1   3 use HTTP::Status;
  1         1  
  1         226  
24              
25             sub new {
26 0     0     my ($proto, $status) = splice @_, 0, 2;
27 0   0       my $class = ref $proto || $proto;
28              
29 0           return $class->SUPER::new(
30             HTTP::Status::status_message($status),
31             $status,
32             headers => [ @_ ],
33             );
34             }
35              
36             __PACKAGE__->mk_ro_accessors(qw(headers));
37              
38             package Spike::Error::HTTP_OK;
39              
40 1     1   4 use base qw(Spike::Error);
  1         0  
  1         49  
41              
42             1;