mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/net/imap.rb: added response to Net::IMAP::ResponseError.
a patch from Eric Hodel in [ruby-core:24111]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
432768449d
commit
00f5982e97
2 changed files with 19 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Jul 2 11:16:25 2009 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/net/imap.rb: added response to Net::IMAP::ResponseError.
|
||||||
|
a patch from Eric Hodel in [ruby-core:24111].
|
||||||
|
|
||||||
Thu Jul 2 08:04:39 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Jul 2 08:04:39 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* time.c (num_exact): rb_check_to_integer() can deal with both of
|
* time.c (num_exact): rb_check_to_integer() can deal with both of
|
||||||
|
|
|
@ -947,7 +947,7 @@ module Net
|
||||||
@greeting = get_response
|
@greeting = get_response
|
||||||
if @greeting.name == "BYE"
|
if @greeting.name == "BYE"
|
||||||
@sock.close
|
@sock.close
|
||||||
raise ByeResponseError, @greeting.raw_data
|
raise ByeResponseError, @greeting
|
||||||
end
|
end
|
||||||
|
|
||||||
@client_thread = Thread.current
|
@client_thread = Thread.current
|
||||||
|
@ -993,7 +993,7 @@ module Net
|
||||||
end
|
end
|
||||||
if resp.name == "BYE" && @logout_command_tag.nil?
|
if resp.name == "BYE" && @logout_command_tag.nil?
|
||||||
@sock.close
|
@sock.close
|
||||||
@exception = ByeResponseError.new(resp.raw_data)
|
@exception = ByeResponseError.new(resp)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
when ContinuationRequest
|
when ContinuationRequest
|
||||||
|
@ -1025,9 +1025,9 @@ module Net
|
||||||
resp = @tagged_responses.delete(tag)
|
resp = @tagged_responses.delete(tag)
|
||||||
case resp.name
|
case resp.name
|
||||||
when /\A(?:NO)\z/ni
|
when /\A(?:NO)\z/ni
|
||||||
raise NoResponseError, resp.data.text
|
raise NoResponseError, resp
|
||||||
when /\A(?:BAD)\z/ni
|
when /\A(?:BAD)\z/ni
|
||||||
raise BadResponseError, resp.data.text
|
raise BadResponseError, resp
|
||||||
else
|
else
|
||||||
return resp
|
return resp
|
||||||
end
|
end
|
||||||
|
@ -3328,6 +3328,16 @@ module Net
|
||||||
# Superclass of all errors used to encapsulate "fail" responses
|
# Superclass of all errors used to encapsulate "fail" responses
|
||||||
# from the server.
|
# from the server.
|
||||||
class ResponseError < Error
|
class ResponseError < Error
|
||||||
|
|
||||||
|
# The response that caused this error
|
||||||
|
attr_accessor :response
|
||||||
|
|
||||||
|
def initialize(response)
|
||||||
|
@response = response
|
||||||
|
|
||||||
|
super @response.data.text
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Error raised upon a "NO" response from the server, indicating
|
# Error raised upon a "NO" response from the server, indicating
|
||||||
|
|
Loading…
Reference in a new issue