Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}).catch((e) => {
if (e.name === 'ThrottlingException') {
logger.error('CloudWatch subscription logic temporarily throttled by AWS.');
} else {
throw e;
}
});
const emptyBucket = async (event) => {
const requestType = get(event, 'RequestType');
if (requestType === 'Delete') {
const Bucket = get(event, 'ResourceProperties.BucketName');
if (Bucket === undefined) {
throw new Error('No Bucket Provided.');
}
await s3.emptyBucket({ Bucket });
logger.info(`${Bucket} emptied!`);
}
};