Class BaseGoogleAdsException.Factory<T extends BaseGoogleAdsException,U extends com.google.protobuf.Message>

java.lang.Object
com.google.ads.googleads.lib.stubs.exceptions.BaseGoogleAdsException.Factory<T,U>
Enclosing class:
BaseGoogleAdsException

public abstract static class BaseGoogleAdsException.Factory<T extends BaseGoogleAdsException,U extends com.google.protobuf.Message> extends Object
Optionally create a GoogleAdsException from a ApiException.

Returns an Optional containing the underlying GoogleAdsException if the ApiException contains the appropriate metadata.

Returns an empty Optional if the required metadata is not present or is not parsable.

  • Constructor Details

    • Factory

      public Factory()
  • Method Details

    • createKey

      protected static io.grpc.Metadata.Key<byte[]> createKey(String trailerKey)
    • createGoogleAdsException

      public Optional<T> createGoogleAdsException(com.google.api.gax.rpc.ApiException source)
    • createException

      protected abstract T createException(com.google.api.gax.rpc.ApiException source, byte[] protoData, io.grpc.Metadata metadata) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • getTrailerKey

      public abstract io.grpc.Metadata.Key<byte[]> getTrailerKey()
      Returns a Metadata.Key representing the key which the GoogleAdsFailure is returned in the metadata.
    • createGoogleAdsFailure

      public abstract U createGoogleAdsFailure()
      Create an empty GoogleAdsFailure instance for this version.
    • createGoogleAdsFailure

      public abstract U createGoogleAdsFailure(byte[] serializedBytes) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException