class DingBot::Error::ResponseError
Custom error class for rescuing from HTTP response errors.
Public Class Methods
new(response)
click to toggle source
Calls superclass method
# File lib/dingbot/error.rb, line 17 def initialize(response) @response = response super(build_error_message) end
Public Instance Methods
response_status()
click to toggle source
Status code returned in the http response.
@return [Integer]
# File lib/dingbot/error.rb, line 25 def response_status @response.code end
Private Instance Methods
build_error_message()
click to toggle source
Human friendly message.
@return [String]
# File lib/dingbot/error.rb, line 34 def build_error_message parsed_response = @response.parsed_response message = parsed_response.message || parsed_response.error "Server responded with code #{@response.code}, message: " \ "Request URI: #{@response.request.base_uri}#{@response.request.path}" end