Exception: SalesforceBulk2::SalesforceError
- Inherits:
-
StandardError
- Object
- StandardError
- SalesforceBulk2::SalesforceError
- Defined in:
- lib/salesforce_bulk2/salesforce_error.rb
Overview
An exception raised when any non successful request is made through the Salesforce Bulk API.
Instance Attribute Summary collapse
-
#error_code ⇒ Object
The status code from the server response body.
-
#response ⇒ Object
The Net::HTTPResponse instance from the API call.
Instance Method Summary collapse
-
#initialize(response) ⇒ SalesforceError
constructor
A new instance of SalesforceError.
Constructor Details
#initialize(response) ⇒ SalesforceError
Returns a new instance of SalesforceError.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/salesforce_bulk2/salesforce_error.rb', line 9 def initialize(response) self.response = response data = XmlSimple.xml_in(response.body, 'ForceArray' => false) if data # seems responses for CSV requests use a different XML return format # (use invalid_error.xml for reference) if !data['exceptionMessage'].nil? = data['exceptionMessage'] else # SOAP error response = data['Body']['Fault']['faultstring'] end self.error_code = response.code end super() end |
Instance Attribute Details
#error_code ⇒ Object
The status code from the server response body.
7 8 9 |
# File 'lib/salesforce_bulk2/salesforce_error.rb', line 7 def error_code @error_code end |
#response ⇒ Object
The Net::HTTPResponse instance from the API call.
5 6 7 |
# File 'lib/salesforce_bulk2/salesforce_error.rb', line 5 def response @response end |