Exemplo n.º 1
0
 // Annoying, but GaxPreconditions.CheckArgument doesn't return anything, because it doesn't have the whole argument.
 // Maybe we should have an overload for that. (It's only really a problem in constructor chaining...)
 private static AnnotateImageResponse CheckHasError(AnnotateImageResponse response)
 {
     GaxPreconditions.CheckNotNull(response, nameof(response));
     GaxPreconditions.CheckArgument(response.Error != null, nameof(response), "response must contain an error");
     return(response);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructs an exception based on the error in <paramref name="response"/>.
 /// </summary>
 /// <param name="response">The response containing the error. Must not be null, and the <see cref="AnnotateImageResponse.Error"/>
 /// property must not be null.</param>
 public AnnotateImageException(AnnotateImageResponse response) : base(CheckHasError(response).Error.Message)
 {
     this.Response = response;
 }