File Coverage

blib/lib/Fey/Exceptions.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 18 100.0


line stmt bran cond sub pod time code
1             package Fey::Exceptions;
2              
3 28     28   1047 use strict;
  28         34  
  28         1007  
4 28     28   112 use warnings;
  28         48  
  28         2274  
5              
6             our $VERSION = '0.42';
7              
8             my %E;
9              
10             BEGIN {
11 28     28   946 %E = (
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 28     28   14243 use Exception::Class (%E);
  28         208342  
  28         226  
41              
42             Fey::Exception->Trace(1);
43              
44 28     28   40862 use base 'Exporter';
  28         49  
  28         2858  
45              
46             our @EXPORT_OK = map { $_->{alias} || () } values %E;
47              
48             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