Ads API .NET library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Google.Api.Ads.Common.Lib.ErrorHandler Class Reference

Handles errors for an Ads API. More...

Inheritance diagram for Google.Api.Ads.Common.Lib.ErrorHandler:
Google.Api.Ads.AdWords.Util.BatchJob.BulkJobErrorHandler

Public Member Functions

 ErrorHandler (AppConfig config)
 Initializes a new instance of the ErrorHandler class. More...
 
virtual void DoExponentialBackoff ()
 Does the exponential backoff. More...
 
virtual bool HaveMoreRetryAttemptsLeft ()
 Checks if there are more retry attempts left. More...
 
virtual void IncrementRetriedAttempts ()
 Increment the counter for attempts retried. More...
 
virtual bool IsTransientError (Exception exception)
 Determines whether the exception thrown by the server is a transient error. More...
 
virtual void PrepareForRetry (Exception exception)
 Prepares the system for retrying the last failed call. More...
 
virtual bool ShouldRetry (Exception exception)
 Checks if an API call should be retried when an exception occurs. More...
 

Protected Attributes

const int WAIT_TIME = 30000
 Wait time in ms to wait before retrying a call. The actual retry time will be higher due to exponential backoff. More...
 
readonly AppConfig config
 The application configuration. More...
 

Detailed Description

Handles errors for an Ads API.

Constructor & Destructor Documentation

Google.Api.Ads.Common.Lib.ErrorHandler.ErrorHandler ( AppConfig  config)
inline

Initializes a new instance of the ErrorHandler class.

Parameters
configThe application configuration instance.

Member Function Documentation

virtual void Google.Api.Ads.Common.Lib.ErrorHandler.DoExponentialBackoff ( )
inlinevirtual

Does the exponential backoff.

virtual bool Google.Api.Ads.Common.Lib.ErrorHandler.HaveMoreRetryAttemptsLeft ( )
inlinevirtual

Checks if there are more retry attempts left.

Returns
True, if there are more retry attempts left, false otherwise.
virtual void Google.Api.Ads.Common.Lib.ErrorHandler.IncrementRetriedAttempts ( )
inlinevirtual

Increment the counter for attempts retried.

virtual bool Google.Api.Ads.Common.Lib.ErrorHandler.IsTransientError ( Exception  exception)
inlinevirtual

Determines whether the exception thrown by the server is a transient error.

Parameters
exceptionThe exception.
Returns
True, if the server exception is a transient error, false otherwise.

Reimplemented in Google.Api.Ads.AdWords.Util.BatchJob.BulkJobErrorHandler.

virtual void Google.Api.Ads.Common.Lib.ErrorHandler.PrepareForRetry ( Exception  exception)
inlinevirtual

Prepares the system for retrying the last failed call.

Parameters
exceptionThe exception.

Reimplemented in Google.Api.Ads.AdWords.Util.BatchJob.BulkJobErrorHandler.

virtual bool Google.Api.Ads.Common.Lib.ErrorHandler.ShouldRetry ( Exception  exception)
inlinevirtual

Checks if an API call should be retried when an exception occurs.

Parameters
exceptionThe exception.
Returns
True, if the call should be retried, false otherwise.

Reimplemented in Google.Api.Ads.AdWords.Util.BatchJob.BulkJobErrorHandler.

Member Data Documentation

readonly AppConfig Google.Api.Ads.Common.Lib.ErrorHandler.config
protected

The application configuration.

const int Google.Api.Ads.Common.Lib.ErrorHandler.WAIT_TIME = 30000
protected

Wait time in ms to wait before retrying a call. The actual retry time will be higher due to exponential backoff.


The documentation for this class was generated from the following file: