Exception: Transport::UnexpectedStatusCodeError
- Inherits:
-
StandardError
- Object
- StandardError
- Transport::UnexpectedStatusCodeError
- Defined in:
- lib/transport/unexpected_status_code_error.rb
Overview
The UnexpectedStatusCodeError is raised if the :expected_status_code option is given to the :request method and the responded status code is different from the expected one.
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(status_code, message = nil) ⇒ UnexpectedStatusCodeError
constructor
A new instance of UnexpectedStatusCodeError.
- #to_s ⇒ Object
Constructor Details
#initialize(status_code, message = nil) ⇒ UnexpectedStatusCodeError
Returns a new instance of UnexpectedStatusCodeError.
11 12 13 |
# File 'lib/transport/unexpected_status_code_error.rb', line 11 def initialize(status_code, = nil) @status_code, @message = status_code, end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
9 10 11 |
# File 'lib/transport/unexpected_status_code_error.rb', line 9 def @message end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
8 9 10 |
# File 'lib/transport/unexpected_status_code_error.rb', line 8 def status_code @status_code end |
Instance Method Details
#to_s ⇒ Object
15 16 17 |
# File 'lib/transport/unexpected_status_code_error.rb', line 15 def to_s "#{super} received status code #{self.status_code}" + (@message ? " [#{@message}]" : "") end |