# phpman > perldoc > XML::SAX::Exception

## NAME
    [XML::SAX::Exception](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ASAX%3A%3AException/markdown) - Exception classes for [XML::SAX](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ASAX/markdown)

## SYNOPSIS
      throw [XML::SAX::Exception::NotSupported](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ASAX%3A%3AException%3A%3ANotSupported/markdown)(
              Message => "The foo feature is not supported",
              );

## DESCRIPTION
    This module is the base class for all SAX Exceptions, those defined in the spec as well as those
    that one may create for one's own SAX errors.

    There are three subclasses included, corresponding to those of the SAX spec:

      [XML::SAX::Exception::NotSupported](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ASAX%3A%3AException%3A%3ANotSupported/markdown)
      [XML::SAX::Exception::NotRecognized](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ASAX%3A%3AException%3A%3ANotRecognized/markdown)
      [XML::SAX::Exception::Parse](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ASAX%3A%3AException%3A%3AParse/markdown)

    Use them wherever you want, and as much as possible when you encounter such errors. SAX is meant
    to use exceptions as much as possible to flag problems.

## CREATING NEW EXCEPTION CLASSES
    All you need to do to create a new exception class is:

      @[XML::SAX::Exception::MyException::ISA](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ASAX%3A%3AException%3A%3AMyException%3A%3AISA/markdown) = ('[XML::SAX::Exception](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ASAX%3A%3AException/markdown)')

    The given package doesn't need to exist, it'll behave correctly this way. If your exception
    refines an existing exception class, then you may also inherit from that instead of from the
    base class.

## THROWING EXCEPTIONS
    This is as simple as exemplified in the SYNOPSIS. In fact, there's nothing more to know. All you
    have to do is:

      throw [XML::SAX::Exception::MyException](https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ASAX%3A%3AException%3A%3AMyException/markdown)( Message => 'Something went wrong' );

    and voila, you've thrown an exception which can be caught in an eval block.

