Hi Etienne, I've actually wrapped the *SOAP::WSDL::Client::call call in my Moose classes to trap various errors with Try::Tiny. I've had to set die_on_faults to true because I don't want to accidentally forget to trap an error. I fall back to regex tests. My actual code winds up looking like this:
sub _override_soap_wsdl_client_call { my $self = shift; no warnings 'redefine'; *SOAP::WSDL::Client::call = sub { my ( $soap_object, $method, @data_from ) = @_; # throttling to avoid the RateExceededError # it doesn't allow requests more often than .6 seconds $self->_throttle_request; $self->_try_soap_call( $soap_object, $method, \@data_from ); }; } sub _try_soap_call { my ( $self, $soap, $method, $data_from ) = @_; my $client = $self->third_party; # Google::Ads::AdWords::Client my $call = $self->_original_soap_wsdl_client_call; try { $soap->$call( $method, @$data_from ); } catch { # For each of these error conditions, we take some action and try the # call again. If it fails at that point, we don't trap the error. if (/AuthenticationError.GOOGLE_ACCOUNT_COOKIE_INVALID/) { log("AuthenticationError: refreshing authentication token"); $self->_refresh_auth_token($client); } elsif (/RateExceededError/) { log("Sleeping for 30 seconds due to RateExceededError"); sleep 30; } elsif (/InternalApiError.UNEXPECTED_INTERNAL_API_ERROR/) { log("Unexpected internal API error on Google's side"); sleep 10; } else { croak $_; } $soap->$call( $method, @$data_from ); }; } (Note that I'm skipping a lot of code here. I'm just showing the structure of my approach) Feedback welcome. Cheers, Ovid -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en