davidbiehl/ecwid_api

View on GitHub
lib/ecwid_api/error.rb

Summary

Maintainability
A
0 mins
Test Coverage
module EcwidApi
  class Error < StandardError; end;

  class ResponseError < Error
    def initialize(response)
      if response.respond_to?(:reason_phrase)
        super "#{response.reason_phrase} (#{response.status})\n#{response.body}"
      else
        super "The Ecwid API responded with an error (#{response.status})"
      end
    end
  end
end