The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Servlet::Util::Exception - exception base class

SYNOPSIS

  eval {
      Servlet::Util::Exception->throw("oops");
  };

  if ($@) {
      warn "caught exception: $@\n";
  }

DESCRIPTION

This is a base class for exceptions. It extends Exception::Class::Base. See Exception::Class for a full list of inherited methods.

There is only one exception to the inherited API: tracing is on by default. This means that a stack trace will be created when an exception is thrown. By way of comparison to java.lang.Throwable, it's as if fillInStackTrace() is automatically called inside throw(). To selectively disable tracing for a subclass, do the following:

  My::Exception::do_trace(0);

CONSTRUCTOR

new($msg)

Construct an instance with the given error message.

Exceptions are rarely directly constructed. Usually they are constructed and thrown in one call to throw().

Parameters:

$msg

the error message

CLASS METHODS

throw($msg)

Constructs an instance with the given error essage and then die()s.

Parameters:

$msg

the error message

METHODS

getMessage()

Returns the error message.

toString()

Returns a short description of the exception, including the stack trace if the exception has been thrown.

EXCEPTION SUBCLASSESS

These commonly encountered exceptions are provided as utilities.

Servlet::Util::IOException

Thrown to indicate than an I/O exception of some sort has occurred.

Servlet::Util::IllegalArgumentException

Thrown to indicate that a method has been passed an illegal or inappropriate argument.

Servlet::Util::IllegalStateException

Thrown to indicate that a method has been invoked at an illegal or inappropriate time.

Servlet::Util::IndexOutOfBoundsException

Thrown to indicate that an index of some sort (such as to an array) is out of range.

Servlet::Util::UndefReferenceException

Thrown to indicate that undef was used in a case where a value is required.

Servlet::Util::UnsupportedEncodingException

Thrown to indicate that the chosen character encoding is unsupported by the environment (most commonly encountered during character conversions on byte streams).

SEE ALSO

Exception::Class

AUTHOR

Brian Moseley, bcm@maz.org