Exception: Transport::UnexpectedStatusCodeError

Inherits:
StandardError
  • Object
show all
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

Instance Method Summary collapse

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, message = nil)
  @status_code, @message = status_code, message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



9
10
11
# File 'lib/transport/unexpected_status_code_error.rb', line 9

def message
  @message
end

#status_codeObject (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_sObject



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