Tabnine Logo
GoogleJsonError.setErrors
Code IndexAdd Tabnine to your IDE (free)

How to use
setErrors
method
in
com.google.api.client.googleapis.json.GoogleJsonError

Best Java code snippets using com.google.api.client.googleapis.json.GoogleJsonError.setErrors (Showing top 3 results out of 315)

origin: googleapis/google-cloud-java

@Test
public void testGetChangeRequestNotFound() {
 EasyMock.reset(batchMock);
 Capture<RpcBatch.Callback<Change>> callback = Capture.newInstance();
 Capture<Map<DnsRpc.Option, Object>> capturedOptions = Capture.newInstance();
 batchMock.addGetChangeRequest(
   EasyMock.eq(ZONE_NAME),
   EasyMock.eq(CHANGE_REQUEST_COMPLETE.getGeneratedId()),
   EasyMock.capture(callback),
   EasyMock.capture(capturedOptions));
 EasyMock.replay(batchMock);
 DnsBatchResult<ChangeRequest> batchResult =
   dnsBatch.getChangeRequest(ZONE_NAME, CHANGE_REQUEST_COMPLETE.getGeneratedId());
 assertEquals(0, capturedOptions.getValue().size());
 RpcBatch.Callback<Change> capturedCallback = callback.getValue();
 GoogleJsonError error = new GoogleJsonError();
 GoogleJsonError.ErrorInfo errorInfo = new GoogleJsonError.ErrorInfo();
 errorInfo.setReason("reason");
 errorInfo.setLocation("entity.parameters.changeId");
 error.setCode(404);
 error.setErrors(ImmutableList.of(errorInfo));
 capturedCallback.onFailure(error);
 assertNull(batchResult.get());
}
origin: org.apache.beam/beam-sdks-java-io-google-cloud-platform

/** A helper that generates the error JSON payload that Google APIs produce. */
private static GoogleJsonErrorContainer errorWithReasonAndStatus(String reason, int status) {
 ErrorInfo info = new ErrorInfo();
 info.setReason(reason);
 info.setDomain("global");
 // GoogleJsonError contains one or more ErrorInfo objects; our utiities read the first one.
 GoogleJsonError error = new GoogleJsonError();
 error.setErrors(ImmutableList.of(info));
 error.setCode(status);
 error.setMessage(reason);
 // The actual JSON response is an error container.
 GoogleJsonErrorContainer container = new GoogleJsonErrorContainer();
 container.setError(error);
 return container;
}
origin: GoogleCloudPlatform/bigdata-interop

 @Override
 public LowLevelHttpRequest buildRequest(String method, String url) throws IOException {
  errorInfo.setFactory(jsonFactory);
  GoogleJsonError jsonError = new GoogleJsonError();
  jsonError.setCode(status);
  jsonError.setErrors(Collections.singletonList(errorInfo));
  jsonError.setMessage(httpStatusString);
  jsonError.setFactory(jsonFactory);
  GenericJson errorResponse = new GenericJson();
  errorResponse.set("error", jsonError);
  errorResponse.setFactory(jsonFactory);
  return new MockLowLevelHttpRequest()
    .setResponse(
      new MockLowLevelHttpResponse()
        .setContent(errorResponse.toPrettyString())
        .setContentType(Json.MEDIA_TYPE)
        .setStatusCode(status));
 }
};
com.google.api.client.googleapis.jsonGoogleJsonErrorsetErrors

Javadoc

Sets the list of detailed errors or null for none.

Popular methods of GoogleJsonError

  • getMessage
    Returns the human-readable explanation of the error or null for none.
  • getCode
    Returns the HTTP status code of this response or null for none.
  • <init>
  • getErrors
    Returns the list of detailed errors or null for none.
  • setCode
    Sets the HTTP status code of this response or null for none.
  • setMessage
    Sets the human-readable explanation of the error or null for none.
  • toPrettyString
  • get
  • setFactory
  • toString

Popular in Java

  • Creating JSON documents from java classes using gson
  • getResourceAsStream (ClassLoader)
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • JOptionPane (javax.swing)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now