Ruby exception objects are subclasses of
Exception. However, operating systems typically report errors using plain integers. Module
Errno is created dynamically to map these operating system errors to Ruby classes, with each error number generating its own subclass of
SystemCallError. As the subclass is created in module
Errno, its name will start
Errno::. The names of the
:: classes depend on the environment in which Ruby runs. On a typical Unix or Windows platform, there are
Errno classes such as
Errno::EINTR, and so on.
The integer operating system error number corresponding to a particular error is available as the class constant
Errno::EACCES::Errno → 13 Errno::EAGAIN::Errno → 11 Errno::EINTR::Errno → 4
The full list of operating system errors on your particular platform are available as the constants of
Errno.constants → E2BIG, EACCES, EADDRINUSE, EADDRNOTAVAIL, EADV, EAFNOSUPPORT, EAGAIN, ...
Extracted from the book "Programming Ruby - The Pragmatic Programmer's Guide"
Copyright © 2001 by Addison Wesley Longman, Inc. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/).
Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder.
Distribution of the work or derivative of the work in any standard (paper) book form is prohibited unless prior permission is obtained from the copyright holder.