File Coverage

blib/lib/Geoffrey/Exception/Database.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod 4 4 100.0
total 37 37 100.0


line stmt bran cond sub pod time code
1             package Geoffrey::Exception::Database;
2              
3 14     14   729 use utf8;
  14         29  
  14         88  
4 14     14   556 use 5.016;
  14         49  
5 14     14   71 use strict;
  14         29  
  14         377  
6 14     14   91 use warnings;
  14         81  
  14         529  
7 14     14   110 use Carp qw/longmess/;
  14         41  
  14         1632  
8              
9             $Geoffrey::Exception::Database::VERSION = '0.000204';
10              
11             use Exception::Class 1.23 (
12 14         149 'Geoffrey::Exception::Database' => { description => 'Unidentified exception', },
13             'Geoffrey::Exception::Database::NoDbh' =>
14             { description => 'No default value set for column in table!', },
15             'Geoffrey::Exception::Database::NotDbh' =>
16             { description => 'Given dbh is in a non valid type!', },
17             'Geoffrey::Exception::Database::SqlHandle' =>
18             { description => 'No default value set for column in table!', },
19             'Geoffrey::Exception::Database::CorruptChangeset' =>
20             { description => 'No default value set for column in table!', },
21 14     14   150 );
  14         276  
22              
23             sub throw_no_dbh {
24 5     5 1 53 return Geoffrey::Exception::Database::NoDbh->throw(
25             "No default dbh value is set\n" . longmess );
26             }
27              
28             sub throw_not_dbh {
29 1     1 1 15 return Geoffrey::Exception::Database::NotDbh->throw(
30             "Given dbh is in a non valid type\n" . longmess );
31             }
32              
33             sub throw_sql_handle {
34 5     5 1 2071 my ( $s_throw_message, $s_sql ) = @_;
35 5         70 return Geoffrey::Exception::Database::SqlHandle->throw(
36             "Can't handle sql: $s_sql $s_throw_message\n" . longmess );
37             }
38              
39             sub throw_changeset_corrupt {
40 1     1 1 4 my ( $id, $value, $resp ) = @_;
41 1         37 return Geoffrey::Exception::Database::CorruptChangeset->throw(
42             "MD5 hash changed for changeset: $id expect $value got $resp\n" . longmess );
43             }
44              
45             1;
46              
47             __END__