Exception: SystemCallError
- Inherits:
-
StandardError
- Object
- Exception
- StandardError
- SystemCallError
- Defined in:
- error.c
Overview
SystemCallError is the base class for all low-level platform-dependent errors.
The errors available on the current platform are subclasses of SystemCallError and are defined in the Errno module.
File.open("does/not/exist")
raises the exception:
Errno::ENOENT: No such file or directory - does/not/exist
Class Method Summary collapse
-
.===(other) ⇒ Boolean
Return
true
if the receiver is a genericSystemCallError
, or if the error numbersself
and other are the same.
Instance Method Summary collapse
-
#errno ⇒ Fixnum
Return this SystemCallError's error number.
-
#new(msg, errno) ⇒ Object
constructor
If errno corresponds to a known system error code, constructs the appropriate
Errno
class for that error, otherwise constructs a genericSystemCallError
object.
Methods inherited from Exception
#==, #backtrace, #exception, exception, #inspect, #message, #set_backtrace, #to_s
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(int argc, VALUE *argv, VALUE self)
{
#if !defined(_WIN32)
char *strerror();
#endif
const char *err;
VALUE mesg, error;
VALUE klass = rb_obj_class(self);
if (klass == rb_eSystemCallError) {
st_data_t data = (st_data_t)klass;
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.
|
# File 'error.c'
static VALUE
syserr_eqq(VALUE self, VALUE exc)
{
VALUE num, e;
ID en;
CONST_ID(en, "errno");
if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) {
if (!rb_respond_to(exc, en)) return Qfalse;
}
|
Instance Method Details
#errno ⇒ Fixnum
Return this SystemCallError's error number.
|
# File 'error.c'
static VALUE
syserr_errno(VALUE self)
{
return rb_attr_get(self, rb_intern("errno"));
}
|