Skip to content

Commit

Permalink
Tidy up invoke lambda error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
philmcmahon committed Jan 10, 2025
1 parent a6c1b89 commit 901197f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
CreateFolderRequest,
signedUrlRequestBody,
ExportStatuses,
ExportStatus,
} from '@guardian/transcription-service-common';
import type { SignedUrlResponseBody } from '@guardian/transcription-service-common';
import {
Expand Down Expand Up @@ -340,8 +341,18 @@ const getApp = async () => {
JSON.stringify(exportRequest.data),
);
} catch (e) {
logger.error('Failed to invoke media export lambda', e);
res.status(500).send('Failed to request media export');
const msg = 'Failed to invoke media export lambda';
logger.error(msg, e);
const mediaFailedStatus: ExportStatus = {
status: 'failure',
exportType: 'source-media',
message: msg,
};
currentStatuses = updateStatus(mediaFailedStatus, currentStatuses);
await writeTranscriptionItem(dynamoClient, config.app.tableName, {
...item,
exportStatus: currentStatuses,
});
}
res.send(JSON.stringify(currentStatuses));

Expand Down

0 comments on commit 901197f

Please sign in to comment.