@InternalApi("Visible for testing") static Status convertErrorToStatus(Throwable error) { if (!(error instanceof ApiException)) { return Status.UNKNOWN.withDescription(error.getMessage()); } ApiException apiException = (ApiException) error; Status.CanonicalCode code; try { code = Status.CanonicalCode.valueOf(apiException.getStatusCode().getCode().name()); } catch (IllegalArgumentException e) { code = CanonicalCode.UNKNOWN; } return code.toStatus().withDescription(error.getMessage()); } }
@InternalApi("Visible for testing") static Status convertErrorToStatus(Throwable error) { if (!(error instanceof ApiException)) { return Status.UNKNOWN.withDescription(error.getMessage()); } ApiException apiException = (ApiException) error; Status.CanonicalCode code; try { code = Status.CanonicalCode.valueOf(apiException.getStatusCode().getCode().name()); } catch (IllegalArgumentException e) { code = CanonicalCode.UNKNOWN; } return code.toStatus().withDescription(error.getMessage()); } }
logger.log(Level.WARNING, "ApiException thrown when creating MetricDescriptor.", e); span.setStatus( Status.CanonicalCode.valueOf(e.getStatusCode().getCode().name()) .toStatus() .withDescription(
logger.log(Level.WARNING, "ApiException thrown when exporting TimeSeries.", e); span.setStatus( Status.CanonicalCode.valueOf(e.getStatusCode().getCode().name()) .toStatus() .withDescription(