Programmierung in Ruby

Der Leitfaden der Pragmatischen Programmierer

module Errno

Index:


Rubys Exception-Objekte sind Unterklassen von Exception. Allerdings melden Betriebssysteme üblicherweise ihre Fehler über einfache Nummern. Das Modul Errno wird dynamisch erzeugt, um diese Fehlernummern des Betriebssystems auf Ruby-Klassen umzuschreiben, wobei jede Fehlernummer eine eigene Unterklasse von SystemCallError erzeugt. Da die Unterklasse im Modul Errno erzeugt wird, beginnt ihr Name auch mit Errno::.

Die Namen der Errno::-Klassen hängen von der Umgebung ab, in der Ruby läuft. Auf einer typischen Unix- oder Windows-Plattform sind das Errno-Klassen wie Errno::EACCES, Errno::EAGAIN, Errno::EINTR und so weiter.

Die Fehler-Nummer der Betriebssystems für einen speziellen Fehler ist als Integer erhältlich als Klassen-Konstante Errno::error::Errno.

Errno::EACCES::Errno » 13
Errno::EAGAIN::Errno » 11
Errno::EINTR::Errno » 4

Die vollständige Liste der Betriebssystem-Fehler der eigenen Plattform sind verfügbar als Konstanten von Errno.

Errno.constants » E2BIG, EACCES, EADDRINUSE, EADDRNOTAVAIL, EADV, EAFNOSUPPORT, EAGAIN, ...


Extracted from the book "Programming Ruby - The Pragmatic Programmer's Guide"
Übersetzung: Jürgen Katins
Für das englische Original:
© 2000 Addison Wesley Longman, Inc. Released under the terms of the Open Publication License V1.0. That reference is available for download.
Diese Lizenz sowie das Original vom Herbst 2001 bilden die Grundlage der Übersetzung
Es wird darauf hingewiesen, dass sich die Lizenz des englischen Originals inzwischen geändert hat.
Für die deutsche Übersetzung:
© 2002 Jürgen Katins
Der Copyright-Eigner stellt folgende Lizenzen zur Verfügung:
Nicht-freie Lizenz:
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.
Freie Lizenz:
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".