示例#1
0
        /// <summary>
        /// Gets the Google Ads exception.
        /// </summary>
        /// <param name="e">The aggregate exception from the task.</param>
        /// <returns>The deserialized exception, or null if the exception cannot be deserialized.
        /// </returns>
        private static GoogleAdsException GetGoogleAdsException(AggregateException e)
        {
            RpcException rpcException = e?.InnerExceptions?.FirstOrDefault(
                delegate(Exception innerException)
            {
                return(innerException is RpcException);
            }
                ) as RpcException;

            return(rpcException == null ? null : GoogleAdsException.Create(rpcException));
        }
示例#2
0
 /// <summary>
 /// Creates an <see cref="GoogleAdsException"/> for testing purposes.
 /// </summary>
 internal static GoogleAdsException CreateException(string errorMessage,
                                                    string errorTrigger, string requestId)
 {
     return(GoogleAdsException.Create(CreateRpcException(
                                          errorMessage, errorTrigger, requestId)));
 }
示例#3
0
 /// <summary>
 /// Creates an <see cref="GoogleAdsException"/> for testing purposes.
 /// </summary>
 internal static GoogleAdsException CreateException(string errorMessage,
                                                    string errorTrigger, Metadata responseMetadata)
 {
     return(GoogleAdsException.Create(CreateRpcException(errorMessage, errorTrigger,
                                                         responseMetadata)));
 }