Sha256: 7f84b1b279d1210ee62037dd70fa02ecee77d88504d12ef1f9a3a986d896ba2b
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
module DataMapper module Adapters class SalesforceAdapter < DataObjectsAdapter class Connection module Errors class Error < StandardError; end class FieldNotFound < Error; end class LoginFailed < Error; end class SessionTimeout < Error; end class UnknownStatusCode < Error; end class ServerUnavailable < Error; end class SOAPError < Error def initialize(message, result) @result = result super("#{message}: #{result_message}") end def records @result.to_a end def failed_records @result.reject {|r| r.success} end def successful_records @result.select {|r| r.success} end def result_message failed_records.map do |r| message_for_record(r) end.join("; ") end def message_for_record(record) record.errors.map {|e| "#{e.statusCode}: #{e.message}"}.join(", ") end def server_unavailable? failed_records.any? do |record| record.errors.any? {|e| e.statusCode == "SERVER_UNAVAILABLE"} end end end class CreateError < SOAPError; end class QueryError < SOAPError; end class DeleteError < SOAPError; end class UpdateError < SOAPError; end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
martinemde-dm-salesforce-adapter-1.1.0 | lib/dm-salesforce-adapter/connection/errors.rb |