Adds an error message for accession failure

This commit is contained in:
agryczewski 2022-01-20 10:59:48 -05:00
parent 2de4cdd301
commit f7e4b34107

View File

@ -12,7 +12,7 @@ public enum SecretManager {
private final String resourceId; private final String resourceId;
private SecretManager(String resourceId) { SecretManager(String resourceId) {
this.resourceId = resourceId; this.resourceId = resourceId;
} }
@ -20,7 +20,7 @@ public enum SecretManager {
try (SecretManagerServiceClient client = SecretManagerServiceClient.create()) { try (SecretManagerServiceClient client = SecretManagerServiceClient.create()) {
return client.accessSecretVersion(this.resourceId).getPayload().getData().toStringUtf8(); return client.accessSecretVersion(this.resourceId).getPayload().getData().toStringUtf8();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace(); // TODO: Add plain text error message to log to console
System.exit(1); // Secrets are integral to full operation, crash if not retrieved properly. System.exit(1); // Secrets are integral to full operation, crash if not retrieved properly.
return null; return null;
} }