class Bitly::Error

An error class that covers all potential errors from the Bitly API. In an error scenario, the API is only guaranteed to return a status_code and status_txt: dev.bitly.com/formats.html

Attributes

description[R]

@return [String] The description of the failed request

response[R]

@return [Bitly::HTTP::Response] The response that caused the error

status_code[R]

@return [String] The status code of the failed request

Public Class Methods

new(response) click to toggle source

Creates a new Bitly::Error object

@param [Bitly::HTTP::Response] response The parsed response to the HTTP request

Calls superclass method
# File lib/bitly/error.rb, line 25
def initialize(response)
  @response = response
  @status_code = response.status
  @description = response.body["description"]
  @message = "[#{@status_code}] #{response.body["message"]}"
  super(@message)
end