diff --git a/error.c b/error.c index 1a67316b081ffd..1a8a4cd430eedd 100644 --- a/error.c +++ b/error.c @@ -2981,7 +2981,7 @@ syntax_error_with_path(VALUE exc, VALUE path, VALUE *mesg, rb_encoding *enc) /* * Document-module: Errno - + * * When an operating system encounters an error, * it typically reports the error as an integer error code: * @@ -3022,6 +3022,13 @@ syntax_error_with_path(VALUE exc, VALUE path, VALUE *mesg, rb_encoding *enc) * Errno::ENOENT::Errno # => 2 * Errno::ENOTCAPABLE::Errno # => 0 * + * Each class in Errno can be created with optional messages: + * + * Errno::EPIPE.new # => # + * Errno::EPIPE.new("foo") # => # + * Errno::EPIPE.new("foo", "here") # => # + * + * See SystemCallError.new. */ static st_table *syserr_tbl; @@ -3092,12 +3099,33 @@ get_syserr(int n) /* * call-seq: - * SystemCallError.new(msg, errno) -> system_call_error_subclass + * SystemCallError.new(msg, errno = nil, func = nil) -> system_call_error_subclass * * 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. + * + * If only numeric object is given, it is treated as an Integer _errno_, + * and _msg_ is omitted, otherwise the first argument _msg_ is used as + * the additional error message. + * + * SystemCallError.new(Errno::EPIPE::Errno) + * #=> # + * + * SystemCallError.new("foo") + * #=> # + * + * SystemCallError.new("foo", Errno::EPIPE::Errno) + * #=> # + * + * If _func_ is not +nil+, it is appended to the message with " @ ". + * + * SystemCallError.new("foo", Errno::EPIPE::Errno, "here") + * #=> # + * + * A subclass of SystemCallError can also be instantiated via the + * +new+ method of the subclass. See Errno. */ static VALUE