use of io.grpc.StatusRuntimeException in project android by JetBrains.
the class RpcNetworkRequestsModel method requestHttpResponseBody.
private void requestHttpResponseBody(long connectionId, @NotNull HttpData.Builder httpBuilder) {
NetworkProfiler.HttpDetailsRequest request = NetworkProfiler.HttpDetailsRequest.newBuilder().setConnId(connectionId).setType(NetworkProfiler.HttpDetailsRequest.Type.RESPONSE_BODY).build();
NetworkProfiler.HttpDetailsResponse response;
try {
response = myNetworkService.getHttpDetails(request);
} catch (StatusRuntimeException e) {
return;
}
String payloadId = response.getResponseBody().getPayloadId();
httpBuilder.setResponsePayloadId(payloadId);
}
use of io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class LoggingClientTest method deleteLogExceptionTest.
@Test
@SuppressWarnings("all")
public void deleteLogExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockLoggingServiceV2.addException(exception);
try {
LogNameOneof logName = LogNameOneof.from(LogName.create("[PROJECT]", "[LOG]"));
client.deleteLog(logName);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class LoggingClientTest method listLogEntriesExceptionTest.
@Test
@SuppressWarnings("all")
public void listLogEntriesExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockLoggingServiceV2.addException(exception);
try {
List<String> resourceNames = new ArrayList<>();
String filter = "filter-1274492040";
String orderBy = "orderBy1234304744";
client.listLogEntries(resourceNames, filter, orderBy);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class LoggingClientTest method listLogsExceptionTest.
@Test
@SuppressWarnings("all")
public void listLogsExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockLoggingServiceV2.addException(exception);
try {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.create("[PROJECT]"));
client.listLogs(parent);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
use of io.grpc.StatusRuntimeException in project google-cloud-java by GoogleCloudPlatform.
the class MetricsClientTest method updateLogMetricExceptionTest.
@Test
@SuppressWarnings("all")
public void updateLogMetricExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockMetricsServiceV2.addException(exception);
try {
MetricNameOneof metricName = MetricNameOneof.from(MetricName.create("[PROJECT]", "[METRIC]"));
LogMetric metric = LogMetric.newBuilder().build();
client.updateLogMetric(metricName, metric);
Assert.fail("No exception raised");
} catch (ApiException e) {
Assert.assertEquals(Status.INVALID_ARGUMENT.getCode(), e.getStatusCode());
}
}
Aggregations