in lambda/rest-endpoints/src/curation.ts [25:56]
async function rawCurationDataForToday(
region: string,
variant: string,
): Promise<GetObjectOutput> {
try {
return await s3Client.send(
new GetObjectCommand({
Bucket: getStaticBucketName(),
Key: `${region}/${variant}/curation.json`,
}),
);
} catch (err) {
if (err instanceof S3ServiceException) {
if (err.name == 'NotFound') {
const today = formatDate(new Date(), 'yyyy-MM-dd');
return await s3Client.send(
new GetObjectCommand({
Bucket: getStaticBucketName(),
Key: `${region}/${variant}/${today}/curation.json`,
}),
);
} else {
console.error(`Unexpected S3 exception ${err.name}: `, err);
throw err;
}
} else {
console.error(`Unexpected exception `, err);
throw err;
}
}
}