Codota Logo
GoogleJsonError.setErrors
Code IndexAdd Codota 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)

  • Common ways to obtain GoogleJsonError
private void myMethod () {
GoogleJsonError g =
  • Codota Iconnew GoogleJsonError()
  • Codota IconGoogleJsonResponseException googleJsonResponseException;googleJsonResponseException.getDetails()
  • Smart code suggestions by Codota
}
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

  • Running tasks concurrently on multiple threads
  • setContentView (Activity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • putExtra (Intent)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Collectors (java.util.stream)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now