Raised if a call returns with a SOAP error, gives you easy access to adwords error fields

Methods
N
Attributes
[RW] soap_faultcode
[RW] soap_faultstring
[RW] top_code
[RW] internal
[RW] message
[RW] code
[RW] detail
[RW] field
[RW] index
[RW] isExemptable
[RW] textIndex
[RW] textLength
[RW] trigger
[RW] trigger_ex

The *_ex attributes have been added to correct deficiencies with the initial implementation. They should expose more useful information (i.e. text of errors instead of a SOAP element) and proper mapping of a fault’s trigger and code. The old attributes are left behind for backward compatibility; hopefully this isn’t too confusing!

[RW] soap_faultcode_ex
[RW] soap_faultstring_ex
[RW] code_ex
Class Public methods
new(soap_fault)

Constructor for ApiError.

Args:

  • soap_fault: SOAP fault returned by the service.
# File lib/adwords4r.rb, line 369
      def initialize(soap_fault)
        @soap_faultcode = protect { soap_fault.faultcode }
        @soap_faultcode_ex = protect { soap_fault.faultcode.text }
        @soap_faultstring = protect { soap_fault.faultstring }
        @soap_faultstring_ex = protect { soap_fault.faultstring.text }
        if protect { soap_fault.detail and soap_fault.detail.fault }
          fault = soap_fault.detail.fault
          @top_code = protect { fault.code }
          @internal = protect { fault.internal }
          @message = protect { fault.message }
          @trigger_ex = protect { fault.trigger }
          @code_ex = protect { fault.code }
          if protect { fault.errors and fault.errors.size > 0 }
            error = fault.errors.first
            @code = protect { error.code }
            @detail = protect { error.detail }
            @field = protect { error.field }
            @index = protect { error.index }
            @isExemptable = protect { error.isExemptable }
            @textIndex = protect { error.textIndex }
            @textLength = protect { error.textLength }
            @trigger = protect { error.trigger }
          end
        end
      end