Skip to content

Commit 2068d46

Browse files
committed
🍒 pick 609acd9: 🥅 Add new InvalidResponseError exception class [backport #198]
This copies the InvalidResponseError from #198 and the rdoc update to UnknownResponseError. The behavioral changes from that PR have _not_ been copied.
1 parent e3a6ba4 commit 2068d46

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎lib/net/imap/errors.rb‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,27 @@ class BadResponseError < ResponseError
8181
class ByeResponseError < ResponseError
8282
end
8383

84+
# Error raised when the server sends an invalid response.
85+
#
86+
# This is different from UnknownResponseError: the response has been
87+
# rejected. Although it may be parsable, the server is forbidden from
88+
# sending it in the current context. The client should automatically
89+
# disconnect, abruptly (without logout).
90+
#
91+
# Note that InvalidResponseError does not inherit from ResponseError: it
92+
# can be raised before the response is fully parsed. A related
93+
# ResponseParseError or ResponseError may be the #cause.
94+
class InvalidResponseError < Error
95+
end
96+
8497
# Error raised upon an unknown response from the server.
98+
#
99+
# This is different from InvalidResponseError: the response may be a
100+
# valid extension response and the server may be allowed to send it in
101+
# this context, but Net::IMAP either does not know how to parse it or
102+
# how to handle it. This could result from enabling unknown or
103+
# unhandled extensions. The connection may still be usable,
104+
# but—depending on context—it may be prudent to disconnect.
85105
class UnknownResponseError < ResponseError
86106
end
87107

0 commit comments

Comments
 (0)