The package that contains the information about an exception is an
object of class
Exception, or one of class
Exception's
children. Ruby predefines a tidy hierarchy of exceptions, shown in
Figure 8.1 on page 91. As we'll see later, this hierarchy
makes handling exceptions considerably easier.
When you need to raise an exception, you can use one of the built-in
Exception classes, or you can create one of your own. If you
create your own, you might want to make it a subclass of
StandardError or one of its children. If you don't, your exception
won't be caught by default.
Every
Exception has associated with it a message string and a
stack backtrace. If you define your own exceptions, you can add
additional information.