The package that contains the information about an exception is an
object of class
, or one of class
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
classes, or you can create one of your own. If you
create your own, you might want to make it a subclass of
or one of its children. If you don't, your exception
won't be caught by default.
has associated with it a message string and a
stack backtrace. If you define your own exceptions, you can add