module JamRuby
  class PayPalClientError < StandardError

    attr_accessor :errors
    def initialize(data)
      if data.respond_to?('has_key?')
        self.errors = data
      else
        self.errors = {:message=>data.to_s}
      end
    end # initialize

    def to_s
      s=super
      s << ", errors: #{errors.inspect}" if self.errors.any?
      s
    end
  end
end