Exception: HipChat::ServiceError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/hipchat/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, response: nil) ⇒ ServiceError

Returns a new instance of ServiceError.



5
6
7
8
# File 'lib/hipchat/errors.rb', line 5

def initialize(msg, response: nil)
  @response = response
  @msg = msg
end

Instance Attribute Details

#responseObject

Returns the value of attribute response.



3
4
5
# File 'lib/hipchat/errors.rb', line 3

def response
  @response
end

Instance Method Details

#messageObject



10
11
12
13
14
15
16
# File 'lib/hipchat/errors.rb', line 10

def message
  if @response.respond_to? :body
    "#{@msg}:\nResponse: #{@response.body}"
  else
    @msg
  end
end