Bug #1713 ยป net_imap_response_in_error.diff
lib/net/imap.rb (working copy) | ||
---|---|---|
@greeting = get_response
|
||
if @greeting.name == "BYE"
|
||
@sock.close
|
||
raise ByeResponseError, @greeting.raw_data
|
||
raise ByeResponseError, @greeting
|
||
end
|
||
@client_thread = Thread.current
|
||
... | ... | |
end
|
||
if resp.name == "BYE" && @logout_command_tag.nil?
|
||
@sock.close
|
||
@exception = ByeResponseError.new(resp.raw_data)
|
||
@exception = ByeResponseError.new(resp)
|
||
break
|
||
end
|
||
when ContinuationRequest
|
||
... | ... | |
resp = @tagged_responses.delete(tag)
|
||
case resp.name
|
||
when /\A(?:NO)\z/ni
|
||
raise NoResponseError, resp.data.text
|
||
raise NoResponseError, resp
|
||
when /\A(?:BAD)\z/ni
|
||
raise BadResponseError, resp.data.text
|
||
raise BadResponseError, resp
|
||
else
|
||
return resp
|
||
end
|
||
... | ... | |
# Superclass of all errors used to encapsulate "fail" responses
|
||
# from the server.
|
||
class ResponseError < Error
|
||
# The response that caused this error
|
||
attr_accessor :response
|
||
def initialize(response)
|
||
@response = response
|
||
super @response.data.text
|
||
end
|
||
end
|
||
# Error raised upon a "NO" response from the server, indicating
|