Improve doc for Socket::ResolutionError
(#12434)
Also, a topic about Socket::ResolutionError is added to NEWS
This commit is contained in:
parent
f2d1c3d3ce
commit
34e6bb48af
Notes:
git
2024-12-23 06:05:18 +00:00
Merged-By: shioimm <shioi.mm@gmail.com>
5
NEWS.md
5
NEWS.md
@ -173,6 +173,11 @@ We only list stdlib changes that are notable feature changes.
|
|||||||
* This library is now extracted from the Ruby repository to [ruby/net-http-sspi].
|
* This library is now extracted from the Ruby repository to [ruby/net-http-sspi].
|
||||||
[[Feature #20775]]
|
[[Feature #20775]]
|
||||||
|
|
||||||
|
* Socket
|
||||||
|
|
||||||
|
* Socket::ResolutionError and Socket::ResolutionError#error_code was added.
|
||||||
|
[[Feature #20018]]
|
||||||
|
|
||||||
Other changes are listed in the following sections. we also listed release history from the previous bundled version that is Ruby 3.3.0 if it has GitHub releases.
|
Other changes are listed in the following sections. we also listed release history from the previous bundled version that is Ruby 3.3.0 if it has GitHub releases.
|
||||||
|
|
||||||
The following default gem is added.
|
The following default gem is added.
|
||||||
|
@ -786,7 +786,17 @@ rsock_getfamily(rb_io_t *fptr)
|
|||||||
* call-seq:
|
* call-seq:
|
||||||
* error_code -> integer
|
* error_code -> integer
|
||||||
*
|
*
|
||||||
* Returns the raw error code occurred at name resolution.
|
* Returns the raw error code indicating the cause of the hostname resolution failure.
|
||||||
|
*
|
||||||
|
* begin
|
||||||
|
* Addrinfo.getaddrinfo("ruby-lang.org", nil)
|
||||||
|
* rescue Socket::ResolutionError => e
|
||||||
|
* if e.error_code == Socket::EAI_AGAIN
|
||||||
|
* puts "Temporary failure in name resolution."
|
||||||
|
* end
|
||||||
|
* end
|
||||||
|
*
|
||||||
|
* Note that error codes depend on the operating system.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
sock_resolv_error_code(VALUE self)
|
sock_resolv_error_code(VALUE self)
|
||||||
@ -802,7 +812,7 @@ rsock_init_socket_init(void)
|
|||||||
*/
|
*/
|
||||||
rb_eSocket = rb_define_class("SocketError", rb_eStandardError);
|
rb_eSocket = rb_define_class("SocketError", rb_eStandardError);
|
||||||
/*
|
/*
|
||||||
* ResolutionError is the error class for socket name resolution.
|
* Socket::ResolutionError is the error class for hostname resolution.
|
||||||
*/
|
*/
|
||||||
rb_eResolution = rb_define_class_under(rb_cSocket, "ResolutionError", rb_eSocket);
|
rb_eResolution = rb_define_class_under(rb_cSocket, "ResolutionError", rb_eSocket);
|
||||||
rb_define_method(rb_eResolution, "error_code", sock_resolv_error_code, 0);
|
rb_define_method(rb_eResolution, "error_code", sock_resolv_error_code, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user