Sha256: 76ef67f3e43d518c6e38e90eb96a52ce11ad9dc78f3a4a65847bbe4587d76689

Contents?: true

Size: 550 Bytes

Versions: 25

Compression:

Stored size: 550 Bytes

Contents

# frozen_string_literal: true

module ChartMogul
  class ChartMogulError < StandardError
    attr_reader :error_message, :response, :http_status

    def initialize(error_message, http_status: nil, response: nil)
      @error_message = error_message
      @http_status = http_status
      @response = response

      super(build_message)
    end

    def build_message
      status = http_status ? " (HTTP Status: #{http_status})" : ''
      resp = response ? "\nResponse: #{response}" : ''
      "#{error_message}#{status}#{resp}"
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
chartmogul-ruby-1.6.6 lib/chartmogul/errors/chartmogul_error.rb
chartmogul-ruby-1.6.4 lib/chartmogul/errors/chartmogul_error.rb
chartmogul-ruby-1.6.3 lib/chartmogul/errors/chartmogul_error.rb
chartmogul-ruby-1.6.2 lib/chartmogul/errors/chartmogul_error.rb
chartmogul-ruby-1.6.1 lib/chartmogul/errors/chartmogul_error.rb