Exception: SystemCallError

Inherits:
StandardError show all
Defined in:
error.c

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Exception

#backtrace, #exception, exception, #inspect, #message, #set_backtrace, #to_s, #to_str

Constructor Details

#new(msg, errno) ⇒ Object

If errno corresponds to a known system error code, constructs the appropriate Errno class for that error, otherwise constructs a generic SystemCallError object. The error number is subsequently available via the errno method.



# File 'error.c'

static VALUE
syserr_initialize(argc, argv, self)
int argc;
VALUE *argv;
VALUE self;
{
#if !defined(_WIN32) && !defined(__VMS)
char *strerror();
#endif
char *err;
VALUE mesg, error;
VALUE klass = rb_obj_class(self);

if (klass == rb_eSystemCallError) {
rb_scan_args(argc, argv, "11", &mesg, &error);
if (argc == 1 && FIXNUM_P(mesg)) {
    error = mesg; mesg = Qnil;
}

Class Method Details

.===(other) ⇒ Boolean

Return true if the receiver is a generic SystemCallError, or if the error numbers self and other are the same.

Returns:

  • (Boolean)


# File 'error.c'

static VALUE
syserr_eqq(self, exc)
VALUE self, exc;
{
VALUE num, e;

if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) return Qfalse;
if (self == rb_eSystemCallError) return Qtrue;

num = rb_attr_get(exc, rb_intern("errno"));
if (NIL_P(num)) {
VALUE klass = CLASS_OF(exc);

while (TYPE(klass) == T_ICLASS || FL_TEST(klass, FL_SINGLETON)) {
    klass = (VALUE)RCLASS(klass)->super;
}

Instance Method Details

#errnoFixnum

Return this SystemCallError's error number.

Returns:



# File 'error.c'

static VALUE
syserr_errno(self)
    VALUE self;
{
    return rb_attr_get(self, rb_intern("errno"));
}