diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-02 02:19:37 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-02 02:19:37 +0000 |
commit | 00f5982e9755cf6637321ef97d51a002a5f0a166 (patch) | |
tree | df3417fb6d2b384f86833479be2ab9225db9ea85 /lib/net | |
parent | 432768449deaf044574506d689ca049c4fc796e7 (diff) | |
download | ruby-00f5982e9755cf6637321ef97d51a002a5f0a166.tar.gz |
* 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
Diffstat (limited to 'lib/net')
-rw-r--r-- | lib/net/imap.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 161e7ac32a..e67c294464 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -947,7 +947,7 @@ module Net @greeting = get_response if @greeting.name == "BYE" @sock.close - raise ByeResponseError, @greeting.raw_data + raise ByeResponseError, @greeting end @client_thread = Thread.current @@ -993,7 +993,7 @@ module Net 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 @@ -1025,9 +1025,9 @@ module Net 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 @@ -3328,6 +3328,16 @@ module Net # 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 |