Exception: Net::IMAP::InvalidTaggedResponseError
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
InvalidResponseError,
Error,
StandardError
|
|
|
Instance Chain:
self,
InvalidResponseError,
Error,
StandardError
|
|
| Inherits: |
Net::IMAP::InvalidResponseError
|
| Defined in: | lib/net/imap/errors.rb |
Overview
Error raised when the server sends a tagged #response that is invalid for
the #command #state.
This could be caused by a bug in the server or in ::Net::IMAP. Or it
might indicate a malicious server, a man-in-the-middle attack, or
client-side command injection, so the client should disconnect
automatically and abruptly (without logout).
Class Method Summary
Instance Attribute Summary
-
#command
readonly
Metadata about the matching
::Net::IMAPcommand. -
#response
readonly
The TaggedResponse which triggered this error.
-
#state
readonly
A symbol representing the state of the matching tagged command.
Instance Method Summary
Constructor Details
.new(state, response:, command: nil) ⇒ InvalidTaggedResponseError
# File 'lib/net/imap/errors.rb', line 333
def initialize(state, response:, command: nil) response => TaggedResponse[tag:, name: status] case [state, status, command] in :unknown, _, nil in :incomplete, "OK", {tag: ^tag, name:} in :unstarted | :completed, _, {tag: ^tag, name:} end @state, @command, @response = state, command, response cmd_desc = name ? "#{state} #{name}" : state super "Received tagged #{status} to #{cmd_desc} command (tag=#{tag})" rescue NoMatchingPatternError => err raise ArgumentError, err. end
Instance Attribute Details
#command (readonly)
Metadata about the matching ::Net::IMAP command.
Returns nil when #state is :unknown.
NOTE: The non-nil return type is an unstable API, for debug only. It may be changed by any release, without warning or deprecation.
# File 'lib/net/imap/errors.rb', line 328
attr_reader :command
#response (readonly)
The TaggedResponse which triggered this error
# File 'lib/net/imap/errors.rb', line 331
attr_reader :response
#state (readonly)
A symbol representing the state of the matching tagged command.
:unknown::
#response does not match any known command (#command will be {nil}).
:unstarted::
Any tagged #response is invalid before #command starts sending.
:incomplete::
A tagged {OK} #response is invalid before #command is fully sent.
:completed::
Multiple tagged responses were received for the same command.
NOTE: Command state is neither anticipated nor remembered indefinitely.
:unknown is used before the matching command is called and after the
it is forgotten.
NOTE: This version of ::Net::IMAP does not detect or raise an exception
for all of these states.
# File 'lib/net/imap/errors.rb', line 320
attr_reader :state