Write a better error message when secret not found (follow-up) (#306)
* Write a better error message when key not found * Address additional comments on #182 Co-authored-by: Simon Johansson <simon@simonjohansson.com>
This commit is contained in:
committed by
GitHub
parent
4aed62f922
commit
40fb8d7236
@@ -34,9 +34,17 @@ async function getSecrets(secretRequests, client) {
|
||||
body = responseCache.get(requestPath);
|
||||
cachedResponse = true;
|
||||
} else {
|
||||
const result = await client.get(requestPath);
|
||||
body = result.body;
|
||||
responseCache.set(requestPath, body);
|
||||
try {
|
||||
const result = await client.get(requestPath);
|
||||
body = result.body;
|
||||
responseCache.set(requestPath, body);
|
||||
} catch (error) {
|
||||
const {response} = error;
|
||||
if (response.statusCode === 404) {
|
||||
throw Error(`Unable to retrieve result for "${path}" because it was not found: ${response.body.trim()}`)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
if (!selector.match(/.*[\.].*/)) {
|
||||
selector = '"' + selector + '"'
|
||||
|
||||
Reference in New Issue
Block a user