开发者

Ruby HTTP breaks when server is off

开发者 https://www.devze.com 2022-12-21 07:11 出处:网络
Net::HTTP gives a \"undefined method `closed?\' for nil:NilClass\" if the server is down... is this a开发者_开发知识库 standard response that I can trust? Shouldnt it raise a Net:* exception?

Net::HTTP gives a "undefined method `closed?' for nil:NilClass" if the server is down... is this a开发者_开发知识库 standard response that I can trust? Shouldnt it raise a Net:* exception?

Regards


It should return something like this:

/usr/lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo: Name or service not known (SocketError)
from /usr/lib/ruby/1.8/net/http.rb:560:in `open'
from /usr/lib/ruby/1.8/net/http.rb:560:in `connect'
from /usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
from /usr/lib/ruby/1.8/timeout.rb:93:in `timeout'
from /usr/lib/ruby/1.8/net/http.rb:560:in `connect'
from /usr/lib/ruby/1.8/net/http.rb:553:in `do_start'
from /usr/lib/ruby/1.8/net/http.rb:542:in `start'
from /usr/lib/ruby/1.8/net/http.rb:374:in `get_response'
from /usr/lib/ruby/1.8/net/http.rb:356:in `get'
from httpd.rb:2
0

精彩评论

暂无评论...
验证码 换一张
取 消