File Coverage

blib/lib/Geoffrey/Exception/RequiredValue.pm
Criterion Covered Total %
statement 51 51 100.0
branch 2 2 100.0
condition 14 20 70.0
subroutine 21 21 100.0
pod 15 15 100.0
total 103 109 94.5


line stmt bran cond sub pod time code
1             package Geoffrey::Exception::RequiredValue;
2              
3 16     16   116 use utf8;
  16         37  
  16         107  
4 16     16   703 use 5.016;
  16         54  
5 16     16   128 use strict;
  16         36  
  16         361  
6 16     16   77 use warnings;
  16         63  
  16         536  
7 16     16   86 use Carp qw/longmess/;
  16         30  
  16         3088  
8              
9             $Geoffrey::Exception::RequiredValue::VERSION = '0.000205';
10              
11             use Exception::Class 1.23 (
12 16         287 'Geoffrey::Exception::RequiredValue' => {description => q~Unidentified exception~,},
13             'Geoffrey::Exception::RequiredValue::TableName' => {description => q~No table name is given!~,},
14             'Geoffrey::Exception::RequiredValue::TriggerName' => {description => q~No trigger name is given!~,},
15             'Geoffrey::Exception::RequiredValue::TableColumn' =>
16             {description => q~No default value set for column in table!~,},
17             'Geoffrey::Exception::RequiredValue::ForeignkeyReftable' =>
18             {description => q~No reftable name is given for foreign key in table!~,},
19             'Geoffrey::Exception::RequiredValue::ForeignkeyRefcolumn' =>
20             {description => q~No refcolumn name is given for foreign key in table!~,},
21             'Geoffrey::Exception::RequiredValue::RefTable' =>
22             {description => 'No reftable name is given for foreign key in table'},
23             'Geoffrey::Exception::RequiredValue::RefColumn' =>
24             {description => q~No refcolumn name is given for foreign key in table!~},
25             'Geoffrey::Exception::RequiredValue::ColumnType' => {description => q~Add column needs is given type name!~},
26             'Geoffrey::Exception::RequiredValue::IndexName' => {description => q~To drop index it needs a name!~},
27             'Geoffrey::Exception::RequiredValue::WhereClause' => {description => q~No where clause is given!~},
28             'Geoffrey::Exception::RequiredValue::Values' => {description => q~No values are given!~},
29             'Geoffrey::Exception::RequiredValue::Converter' => {description => q~No changeset converter is given!~},
30             'Geoffrey::Exception::RequiredValue::ChangesetId' => {description => q~No changeset id is given!~},
31             'Geoffrey::Exception::RequiredValue::ActionSub' => {description => q~Sub couldn't be found in action!~},
32             'Geoffrey::Exception::RequiredValue::PackageName' => {description => q~Package name not given!~},
33 16     16   641 );
  16         8877  
34              
35             sub throw_common {
36 12   50 12 1 37 my $s_value_name = shift // q//;
37 12         118 return Geoffrey::Exception::RequiredValue->throw("$s_value_name is missing!\n" . longmess);
38             }
39              
40             sub throw_column_type {
41 2   50 2 1 11 my $s_column_name = shift // q//;
42 2         29 return Geoffrey::Exception::RequiredValue::ColumnType->throw(
43             "The column $s_column_name needs is given type!\n" . longmess);
44             }
45              
46             sub throw_column_default {
47 1     1 1 3 my ($s_value_name, $s_package) = @_;
48 1         15 return Geoffrey::Exception::RequiredValue::TableColumn->throw(
49             "No default value set for column $s_value_name in table! $s_package\n" . longmess);
50             }
51              
52             sub throw_table_name {
53 16   100 16 1 67 my $s_error_value = shift // q//;
54 16         199 return Geoffrey::Exception::RequiredValue::TableName->throw("No table name is given $s_error_value\n" . longmess);
55             }
56              
57             sub throw_index_name {
58 2   100 2 1 14 my $s_error_value = shift // q//;
59 2         33 return Geoffrey::Exception::RequiredValue::IndexName->throw(
60             "To drop index it needs a name in $s_error_value\n" . longmess);
61             }
62              
63             sub throw_trigger_name {
64 7   50 7 1 24 my $s_error_value = shift // q//;
65 7         78 return Geoffrey::Exception::RequiredValue::TriggerName->throw(
66             "No trigger name is given $s_error_value\n" . longmess);
67             }
68              
69             sub throw_reftable_missing {
70 2   100 2 1 11 my $s_error_value = shift // q//;
71 2         23 return Geoffrey::Exception::RequiredValue::RefTable->throw(
72             "No reftable name is given for foreign key in table $s_error_value\n" . longmess);
73             }
74              
75             sub throw_refcolumn_missing {
76 2   100 2 1 11 my $s_error_value = shift // q//;
77 2         20 return Geoffrey::Exception::RequiredValue::RefColumn->throw(
78             "No refcolumn name is given for foreign key in table $s_error_value\n" . longmess);
79             }
80              
81             sub throw_table_column {
82 3     3 1 8 my ($s_value_name, $s_package) = @_;
83 3   50     22 $s_package //= q//;
84 3   50     6 $s_value_name //= q//;
85 3         34 return Geoffrey::Exception::RequiredValue::TableColumn->throw(
86             "No table column is given $s_value_name! $s_package\n" . longmess);
87             }
88              
89             sub throw_where_clause {
90 2   50 2 1 8 my $s_error_value = shift // q//;
91 2         30 return Geoffrey::Exception::RequiredValue::WhereClause->throw(
92             "No where clause is given $s_error_value\n" . longmess);
93             }
94              
95             sub throw_values {
96 1     1 1 2 my ($s_package) = @_;
97 1         11 return Geoffrey::Exception::RequiredValue::Values->throw("Values are missing in $s_package !\n" . longmess);
98             }
99              
100             sub throw_converter {
101 1     1 1 3 my ($s_package) = @_;
102 1         9 return Geoffrey::Exception::RequiredValue::Converter->throw(
103             "No changeset converter is given! $s_package !\n" . longmess);
104             }
105              
106             sub throw_id {
107 2     2 1 7 my ($s_file) = @_;
108 2 100       7 if ($s_file) {
109 1         17 return Geoffrey::Exception::RequiredValue::ChangesetId->throw(
110             "No changeset id is given in file: $s_file!\n" . longmess);
111             }
112 1         13 return Geoffrey::Exception::RequiredValue::ChangesetId->throw("No changeset id is given!\n" . longmess);
113             }
114              
115             sub throw_action_sub {
116 2     2 1 8 my ($s_action) = @_;
117 2         28 return Geoffrey::Exception::RequiredValue::ActionSub->throw(
118             qq~No sub name is given for action "$s_action" !\n~ . longmess);
119             }
120              
121             sub throw_package_name {
122 1     1 1 3 my ($s_action) = @_;
123 1         16 return Geoffrey::Exception::RequiredValue::PackageName->throw(
124             qq~No package name is given for action "$s_action" !\n~ . longmess);
125             }
126              
127             1;
128              
129             __END__