If I am doing something wrong or there is a better (more efficient) way, please reply...
Try
ret_val = service.mutate( ... )
Catch aw_ex As Google.Api.Ads.AdWords.Lib.AdWordsApiException
' Get the API exception ...
Dim api_ex As Google.Api.Ads.AdWords.v201406.ApiException = TryCast( aw_ex.ApiException, Google.Api.Ads.AdWords.v201406.ApiException )
' Set flag to indicate whether or not the exception was handled ...
Dim ex_handled = false
If ( Not api_ex Is Nothing ) Then
If ( Not api_ex.errors is Nothing ) Then
If ( api_ex.errors.Length = 1 ) Then
If ( TypeOf api_ex.errors( 0 ) Is Google.Api.Ads.AdWords.v201406.AdGroupAdError ) then
Dim aga_error = CType( api_ex.errors( 0 ), Google.Api.Ads.AdWords.v201406.AdGroupAdError )
If ( aga_error.reason = Google.Api.Ads.AdWords.v201406.AdGroupAdErrorReason.CANNOT_OPERATE_ON_REMOVED_ADGROUPAD ) then
' Do whatever you need set flag to indicate error has been handled ...
ex_handled = true
End If
End If
End If
End If
' If we could not handle the API error, throw the exception for
' manual inspection ...
If ( Not error_handled ) then
Throw New System.Exception( "AdWords API Error.", aw_ex )
End If
End If