Utilizing the promise
method within my script is essential.
try {
const secretData = await secretManager.getSecretValue({ SecretId: secretId }).promise();
const secretString = secretData.SecretString;
} catch (error) {
if (error.code !== 'ResourceNotFoundException') {
throw(error);
}
}
Upon inspecting the promise method, it reveals a type of
Promise<PromiseResult<AWS.SecretsManager.GetSecretValueResponse, AWS.AWSError>>
.
However, the type of the error
in the catch block remains as unknown
.
I am eager to understand how I can prompt TypeScript to recognize the error's type.