misc: improved error handling

This commit is contained in:
Sheen Capadngan
2024-06-06 03:15:57 +08:00
parent 6a6fe3e202
commit 9fd0373e39
@@ -3394,6 +3394,7 @@ const syncSecretsRundeck = async ({
logger.info("No existing rundeck secrets"); logger.info("No existing rundeck secrets");
} }
try {
for await (const [key, value] of Object.entries(secrets)) { for await (const [key, value] of Object.entries(secrets)) {
if (existingRundeckSecrets.includes(key)) { if (existingRundeckSecrets.includes(key)) {
await request.put(`${integration.url}/api/44/storage/${integration.path}/${key}`, value.value, { await request.put(`${integration.url}/api/44/storage/${integration.path}/${key}`, value.value, {
@@ -3421,6 +3422,13 @@ const syncSecretsRundeck = async ({
}); });
} }
} }
} catch (err: unknown) {
throw new Error(
`Ensure that the provided Rundeck URL is accessible by Infisical and that the linked API token has sufficient permissions.\n\n${
(err as Error).message
}`
);
}
}; };
/** /**