/// <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)); }
/// <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))); }
/// <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))); }