Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Ruby Programming
Previous Page Home Next Page

The Exception Class

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.

Figure not available...

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.
Ruby Programming
Previous Page Home Next Page

  Published under the terms of the Open Publication License Design by Interspire