Skip to content

Commit

Permalink
Assign the secret store and log errors correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewvc committed Jun 1, 2018
1 parent 6a8731c commit 4ca7845
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static String replacePlaceholders(final String input,
SecretStore secretStore = null;
try {
if (secretStoreFactory.exists(secureConfig)) {
secretStoreFactory.load(secureConfig);
secretStore = secretStoreFactory.load(secureConfig);
}
} catch (SecretStoreException.AccessException e) {
// Non-fatal condition
Expand Down Expand Up @@ -62,9 +62,13 @@ static String replacePlaceholders(final String input,
"Cannot evaluate `%s`. Replacement variable `%s` is not defined in a Logstash secret store " +
"or as an Environment entry and there is no default value given.",
matchResult.group(0), name);
throw new MissingSubstitutionVariableError();
throw new MissingSubstitutionVariableError(errMsg);
});
}

static class MissingSubstitutionVariableError extends RuntimeException {}
static class MissingSubstitutionVariableError extends RuntimeException {
public MissingSubstitutionVariableError(String errMsg) {
super(errMsg);
}
}
}

0 comments on commit 4ca7845

Please sign in to comment.