1XML::SAX::Exception(3)User Contributed Perl DocumentationXML::SAX::Exception(3)
2
3
4
6 XML::SAX::Exception - Exception classes for XML::SAX
7
9 throw XML::SAX::Exception::NotSupported(
10 Message => "The foo feature is not supported",
11 );
12
14 This module is the base class for all SAX Exceptions, those defined in
15 the spec as well as those that one may create for one's own SAX errors.
16
17 There are three subclasses included, corresponding to those of the SAX
18 spec:
19
20 XML::SAX::Exception::NotSupported
21 XML::SAX::Exception::NotRecognized
22 XML::SAX::Exception::Parse
23
24 Use them wherever you want, and as much as possible when you encounter
25 such errors. SAX is meant to use exceptions as much as possible to flag
26 problems.
27
29 All you need to do to create a new exception class is:
30
31 @XML::SAX::Exception::MyException::ISA = ('XML::SAX::Exception')
32
33 The given package doesn't need to exist, it'll behave correctly this
34 way. If your exception refines an existing exception class, then you
35 may also inherit from that instead of from the base class.
36
38 This is as simple as exemplified in the SYNOPSIS. In fact, there's
39 nothing more to know. All you have to do is:
40
41 throw XML::SAX::Exception::MyException( Message => 'Something went wrong' );
42
43 and voila, you've thrown an exception which can be caught in an eval
44 block.
45
46
47
48perl v5.16.3 2011-09-14 XML::SAX::Exception(3)