File Coverage

blib/lib/Fey/Exceptions.pm
Criterion Covered Total %
statement 9 11 81.8
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 14 16 87.5


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