| 1 | package Fey::Exceptions; | ||||||||||
| 2 | |||||||||||
| 3 | 27 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 27 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 27 | our $VERSION = '0.42'; | |||||||||
| 7 | |||||||||||
| 8 | 27 | my %E; | |||||||||
| 9 | |||||||||||
| 10 | BEGIN { | ||||||||||
| 11 | 27 | ▶ | %E = ( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 'Fey::Exception' => { | ||||||||||
| 13 | description => | ||||||||||
| 14 | 'Generic exception within the Alzabo API. Should only be used as a base class.', | ||||||||||
| 15 | }, | ||||||||||
| 16 | |||||||||||
| 17 | 'Fey::Exception::ObjectState' => { | ||||||||||
| 18 | description => | ||||||||||
| 19 | 'You called a method on an object which its current state does not allow', | ||||||||||
| 20 | isa => 'Fey::Exception', | ||||||||||
| 21 | alias => 'object_state_error', | ||||||||||
| 22 | }, | ||||||||||
| 23 | |||||||||||
| 24 | 'Fey::Exception::Params' => { | ||||||||||
| 25 | description => | ||||||||||
| 26 | 'An exception generated when there is an error in the parameters passed in a method of function call', | ||||||||||
| 27 | isa => 'Fey::Exception', | ||||||||||
| 28 | alias => 'param_error', | ||||||||||
| 29 | }, | ||||||||||
| 30 | |||||||||||
| 31 | 'Fey::Exception::VirtualMethod' => { | ||||||||||
| 32 | description => | ||||||||||
| 33 | 'Indicates that the method called must be subclassed in the appropriate class', | ||||||||||
| 34 | isa => 'Fey::Exception', | ||||||||||
| 35 | alias => 'virtual_method', | ||||||||||
| 36 | }, | ||||||||||
| 37 | ); | ||||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 27 | ▶ | use Exception::Class (%E); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 41 | |||||||||||
| 42 | 27 | Fey::Exception->Trace(1); | |||||||||
| 43 | |||||||||||
| 44 | 27 | ▶ | use base 'Exporter'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 45 | |||||||||||
| 46 | 27 | ▶ | our @EXPORT_OK = map { $_->{alias} || () } values %E; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | |||||||||||
| 48 | 27 | 1; | |||||||||
| 49 | |||||||||||
| 50 | # ABSTRACT: Defines exceptions used in the core Fey classes | ||||||||||
| 51 | |||||||||||
| 52 | __END__ | ||||||||||
| 53 | |||||||||||
| 54 | =pod | ||||||||||
| 55 | |||||||||||
| 56 | =head1 NAME | ||||||||||
| 57 | |||||||||||
| 58 | Fey::Exceptions - Defines exceptions used in the core Fey classes | ||||||||||
| 59 | |||||||||||
| 60 | =head1 VERSION | ||||||||||
| 61 | |||||||||||
| 62 | version 0.42 | ||||||||||
| 63 | |||||||||||
| 64 | =head1 SYNOPSIS | ||||||||||
| 65 | |||||||||||
| 66 | use Fey::Exceptions qw( param_error ); | ||||||||||
| 67 | |||||||||||
| 68 | =head1 DESCRIPTION | ||||||||||
| 69 | |||||||||||
| 70 | This module defines the exceptions which are used by the core Fey | ||||||||||
| 71 | classes. | ||||||||||
| 72 | |||||||||||
| 73 | =head1 EXCEPTIONS | ||||||||||
| 74 | |||||||||||
| 75 | Loading this module defines the exception classes using | ||||||||||
| 76 | C<Exception::Class>. This module also exports subroutines which can be | ||||||||||
| 77 | used as a shorthand to throw a specific type of exception. | ||||||||||
| 78 | |||||||||||
| 79 | =head2 Fey::Exception | ||||||||||
| 80 | |||||||||||
| 81 | This is the base class for other exception classes, and should not be | ||||||||||
| 82 | used directly. | ||||||||||
| 83 | |||||||||||
| 84 | =head2 Fey::Exception::ObjectState | ||||||||||
| 85 | |||||||||||
| 86 | =head3 object_state_error() | ||||||||||
| 87 | |||||||||||
| 88 | This exception indicates that the object is in a state that means it | ||||||||||
| 89 | cannot execute a certain method. | ||||||||||
| 90 | |||||||||||
| 91 | =head2 Fey::Exception::Params | ||||||||||
| 92 | |||||||||||
| 93 | =head3 param_error() | ||||||||||
| 94 | |||||||||||
| 95 | This exception indicates that there was a problem with the parameters | ||||||||||
| 96 | passed to a method. | ||||||||||
| 97 | |||||||||||
| 98 | =head2 Fey::Exception::VirtualMethod | ||||||||||
| 99 | |||||||||||
| 100 | =head3 virtual_method_error() | ||||||||||
| 101 | |||||||||||
| 102 | This exception indicates that a virtual method was not overridden in | ||||||||||
| 103 | the subclass on which it was called. | ||||||||||
| 104 | |||||||||||
| 105 | =head1 BUGS | ||||||||||
| 106 | |||||||||||
| 107 | See L<Fey> for details on how to report bugs. | ||||||||||
| 108 | |||||||||||
| 109 | =head1 AUTHOR | ||||||||||
| 110 | |||||||||||
| 111 | Dave Rolsky <autarch@urth.org> | ||||||||||
| 112 | |||||||||||
| 113 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 114 | |||||||||||
| 115 | This software is Copyright (c) 2011 - 2015 by Dave Rolsky. | ||||||||||
| 116 | |||||||||||
| 117 | This is free software, licensed under: | ||||||||||
| 118 | |||||||||||
| 119 | The Artistic License 2.0 (GPL Compatible) | ||||||||||
| 120 | |||||||||||
| 121 | =cut | ||||||||||