| 1 | package CLI::Framework::Exceptions; | ||
| 2 | |||
| 3 | 5 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 5 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 5 | our $VERSION = 0.02; | |
| 7 | |||
| 8 | # Make it possible to use aliases directly in client code... | ||
| 9 | 5 | ▶ | use Exporter qw( import ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 5 | our @EXPORT_OK = qw( | |
| 11 | throw_clif_exception | ||
| 12 | throw_app_hook_exception | ||
| 13 | throw_app_opts_parse_exception | ||
| 14 | throw_app_opts_validation_exception | ||
| 15 | throw_app_init_exception | ||
| 16 | throw_invalid_cmd_exception | ||
| 17 | throw_cmd_registration_exception | ||
| 18 | throw_type_exception | ||
| 19 | throw_cmd_opts_parse_exception | ||
| 20 | throw_cmd_validation_exception | ||
| 21 | throw_cmd_run_exception | ||
| 22 | ); | ||
| 23 | |||
| 24 | 5 | our %EXPORT_TAGS = ( all => \@EXPORT_OK ); | |
| 25 | |||
| 26 | # Create exception class hierarchy... | ||
| 27 | use Exception::Class ( | ||
| 28 | 5 | 'CLI::Framework::Exception' => { | |
| 29 | description => 'General CLIF error', | ||
| 30 | alias => 'throw_clif_exception', | ||
| 31 | }, | ||
| 32 | 'CLI::Framework::Exception::AppHookException' => { | ||
| 33 | isa => 'CLI::Framework::Exception', | ||
| 34 | description => 'Application hook method failed preconditions', | ||
| 35 | alias => 'throw_app_hook_exception', | ||
| 36 | }, | ||
| 37 | 'CLI::Framework::Exception::AppOptsParsingException' => { | ||
| 38 | isa => 'CLI::Framework::Exception', | ||
| 39 | description => 'Failed parsing of application options', | ||
| 40 | alias => 'throw_app_opts_parse_exception' | ||
| 41 | }, | ||
| 42 | 'CLI::Framework::Exception::AppOptsValidationException' => { | ||
| 43 | isa => 'CLI::Framework::Exception', | ||
| 44 | description => 'Failed validation of application options', | ||
| 45 | alias => 'throw_app_opts_validation_exception' | ||
| 46 | }, | ||
| 47 | 'CLI::Framework::Exception::AppInitException' => { | ||
| 48 | isa => 'CLI::Framework::Exception', | ||
| 49 | description => 'Failed application initialization', | ||
| 50 | alias => 'throw_app_init_exception' | ||
| 51 | }, | ||
| 52 | 'CLI::Framework::Exception::InvalidCmdException' => { | ||
| 53 | isa => 'CLI::Framework::Exception', | ||
| 54 | description => 'Invalid command', | ||
| 55 | alias => 'throw_invalid_cmd_exception' | ||
| 56 | }, | ||
| 57 | 'CLI::Framework::Exception::CmdRegistrationException' => { | ||
| 58 | isa => 'CLI::Framework::Exception', | ||
| 59 | description => 'Failed command registration', | ||
| 60 | alias => 'throw_cmd_registration_exception', | ||
| 61 | }, | ||
| 62 | 'CLI::Framework::Exception::TypeException' => { | ||
| 63 | isa => 'CLI::Framework::Exception', | ||
| 64 | description => 'Object is not of the proper type', | ||
| 65 | alias => 'throw_type_exception', | ||
| 66 | }, | ||
| 67 | 'CLI::Framework::Exception::CmdOptsParsingException' => { | ||
| 68 | isa => 'CLI::Framework::Exception', | ||
| 69 | description => 'Failed parsing of command options', | ||
| 70 | alias => 'throw_cmd_opts_parse_exception' | ||
| 71 | }, | ||
| 72 | 'CLI::Framework::Exception::CmdValidationException' => { | ||
| 73 | isa => 'CLI::Framework::Exception', | ||
| 74 | description => 'Failed validation of command options/arguments', | ||
| 75 | alias => 'throw_cmd_validation_exception' | ||
| 76 | }, | ||
| 77 | 'CLI::Framework::Exception::CmdRunException' => { | ||
| 78 | isa => 'CLI::Framework::Exception', | ||
| 79 | description => 'Failure to run command', | ||
| 80 | alias => 'throw_cmd_run_exception' | ||
| 81 | }, | ||
| 82 | 5 | ▶ | ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 83 | |||
| 84 | #------- | ||
| 85 | 5 | 1; | |
| 86 | |||
| 87 | __END__ | ||