From 1f80f583361ce119d3b2f0ac2beaf20c2befcc6d Mon Sep 17 00:00:00 2001 From: weiminyu Date: Tue, 18 Sep 2018 09:27:40 -0700 Subject: [PATCH] Let RegistryTool proceed if MetricWriter is unavailable This may happen with automated runs off Google Cloud. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=213462175 --- java/google/registry/tools/RegistryCli.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/java/google/registry/tools/RegistryCli.java b/java/google/registry/tools/RegistryCli.java index 8a9061975..2daa6ab02 100644 --- a/java/google/registry/tools/RegistryCli.java +++ b/java/google/registry/tools/RegistryCli.java @@ -234,7 +234,12 @@ final class RegistryCli implements AutoCloseable, CommandRunner { private void runCommand(Command command) throws Exception { injectReflectively(RegistryToolComponent.class, component, command); if (metricWriter == null && uploadMetrics) { - metricWriter = component.metricWriter(); + try { + metricWriter = component.metricWriter(); + } catch (Exception e) { + System.err.format("Failed to get metricWriter. Got error:\n%s\n\n", e); + uploadMetrics = false; + } } if (command instanceof CommandWithConnection) {