Exception: DataMapper::Adapters::SalesforceAdapter::Connection::Errors::SOAPError
- Inherits:
-
Error
- Object
- StandardError
- Error
- DataMapper::Adapters::SalesforceAdapter::Connection::Errors::SOAPError
show all
- Defined in:
- lib/dm-salesforce-adapter/connection/errors.rb
Instance Method Summary
collapse
Constructor Details
#initialize(message, result) ⇒ SOAPError
Returns a new instance of SOAPError.
15
16
17
18
|
# File 'lib/dm-salesforce-adapter/connection/errors.rb', line 15
def initialize(message, result)
@result = result
super("#{message}: #{result_message}")
end
|
Instance Method Details
#failed_records ⇒ Object
24
25
26
|
# File 'lib/dm-salesforce-adapter/connection/errors.rb', line 24
def failed_records
@result.reject {|r| r.success}
end
|
#message_for_record(record) ⇒ Object
38
39
40
|
# File 'lib/dm-salesforce-adapter/connection/errors.rb', line 38
def message_for_record(record)
record.errors.map {|e| "#{e.statusCode}: #{e.message}"}.join(", ")
end
|
#records ⇒ Object
20
21
22
|
# File 'lib/dm-salesforce-adapter/connection/errors.rb', line 20
def records
@result.to_a
end
|
#result_message ⇒ Object
32
33
34
35
36
|
# File 'lib/dm-salesforce-adapter/connection/errors.rb', line 32
def result_message
failed_records.map do |r|
message_for_record(r)
end.join("; ")
end
|
#server_unavailable? ⇒ Boolean
42
43
44
45
46
|
# File 'lib/dm-salesforce-adapter/connection/errors.rb', line 42
def server_unavailable?
failed_records.any? do |record|
record.errors.any? {|e| e.statusCode == "SERVER_UNAVAILABLE"}
end
end
|
#successful_records ⇒ Object
28
29
30
|
# File 'lib/dm-salesforce-adapter/connection/errors.rb', line 28
def successful_records
@result.select {|r| r.success}
end
|