| 1 | package Geoffrey::Exception::General; | ||||||||||||
| 2 | |||||||||||||
| 3 | 8 | ▶ | use utf8; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 8 | ▶ | use 5.016; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 8 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 8 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 8 | ▶ | use Carp qw/longmess/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 8 | $Geoffrey::Exception::General::VERSION = '0.000206'; | |||||||||||
| 10 | |||||||||||||
| 11 | 8 | ▶ | use Exception::Class 1.23 ( | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | 8 | 'Geoffrey::Exception::General' => { description => 'Unidentified exception', }, | |||||||||||
| 13 | 'Geoffrey::Exception::General::TableNameMissing' => { description => 'No default value set for column in table!', }, | ||||||||||||
| 14 | 'Geoffrey::Exception::General::UnknownAction' => { description => 'No default value set for column in table!', }, | ||||||||||||
| 15 | 'Geoffrey::Exception::General::ParamsMissing' => { description => 'The sub needs some params!', }, | ||||||||||||
| 16 | 'Geoffrey::Exception::General::WrongRef' => { description => 'The sub needs a ref!', }, | ||||||||||||
| 17 | 'Geoffrey::Exception::General::Eval' => { description => 'Eval exception!', }, | ||||||||||||
| 18 | |||||||||||||
| 19 | 8 | ); | |||||||||||
| 20 | |||||||||||||
| 21 | 8 | ▶ | sub throw_wrong_ref { | ||||||||||
|
Subroutine
throw_wrong_ref: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 22 | 8 | my ( $s_sub, $s_type ) = @_; | |||||||||||
| 23 | 8 | return Geoffrey::Exception::General::WrongRef->throw( "$s_sub needs a $s_type\n" . longmess ); | |||||||||||
| 24 | } | ||||||||||||
| 25 | |||||||||||||
| 26 | 4 | ▶ | sub throw_no_table_name { | ||||||||||
|
Subroutine
throw_no_table_name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 27 | 4 | my ($s_throw_message) = @_; | |||||||||||
| 28 | 4 | return Geoffrey::Exception::General::TableNameMissing->throw( | |||||||||||
| 29 | "I can't guess the table $s_throw_message\n" . longmess ); | ||||||||||||
| 30 | } | ||||||||||||
| 31 | |||||||||||||
| 32 | 4 | ▶ | sub throw_unknown_action { | ||||||||||
|
Subroutine
throw_unknown_action: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||
| 33 | 4 | ▶ | my $s_throw_message = shift // q//; | ||||||||||
|
Condition50%1/2
shift() // ""
MC/DC0%0/1
shift() // ""
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 34 | 4 | return Geoffrey::Exception::General::UnknownAction->throw( | |||||||||||
| 35 | "Key for action $s_throw_message not found or implemented.\n Probaply misspelled.\n" . longmess ); | ||||||||||||
| 36 | } | ||||||||||||
| 37 | |||||||||||||
| 38 | 1 | ▶ | sub throw_no_params { | ||||||||||
|
Subroutine
throw_no_params: called CC=4 SCAR=16.8
Pod
documented
| |||||||||||||
| 39 | 1 | ▶ | my $s_throw_message = shift // q//; | ||||||||||
|
Condition50%1/2
shift() // ""
MC/DC0%0/1
shift() // ""
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 40 | 1 | my $s_param = shift; | |||||||||||
| 41 | 1 | my $hr_params = shift; | |||||||||||
| 42 | 1 | ▶ | if ($s_param) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 43 | 0 | return Geoffrey::Exception::General::ParamsMissing->throw( | |||||||||||
| 44 | qq~The sub "$s_throw_message" needs param: '$s_param'\n~ . longmess ); | ||||||||||||
| 45 | } | ||||||||||||
| 46 | 1 | ▶ | if ($hr_params) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 47 | 0 | require Data::Dumper; | |||||||||||
| 48 | 0 | my $s_params = Data::Dumper->new( [$hr_params] )->Terse(1)->Deparse(1)->Sortkeys(1)->Dump; | |||||||||||
| 49 | 0 | return Geoffrey::Exception::General::ParamsMissing->throw( | |||||||||||
| 50 | qq~The sub "$s_throw_message" needs param: '$s_param'!\n$s_params\n~ . longmess ); | ||||||||||||
| 51 | } | ||||||||||||
| 52 | 1 | return Geoffrey::Exception::General::ParamsMissing->throw( | |||||||||||
| 53 | qq~The sub "$s_throw_message" needs some params.\n~ . longmess ); | ||||||||||||
| 54 | } | ||||||||||||
| 55 | |||||||||||||
| 56 | 2 | ▶ | sub throw_eval { | ||||||||||
|
Subroutine
throw_eval: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||
| 57 | 2 | ▶ | my $s_throw_message = shift // q//; | ||||||||||
|
Condition50%1/2
shift() // ""
MC/DC0%0/1
shift() // ""
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 58 | 2 | return Geoffrey::Exception::General::Eval->throw( qq~Eval exception with $s_throw_message.\n~ . longmess ); | |||||||||||
| 59 | } | ||||||||||||
| 60 | |||||||||||||
| 61 | 8 | 1; | |||||||||||
| 62 | |||||||||||||
| 63 | __END__ | ||||||||||||