Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 5x 17x 17x | export function generateErrorResponse(err: Error): string {
const body = {
v: '2',
error: {
code: 'Failed',
message: `An error occurred with Fingerprint Lambda function. Reason ${err}`,
},
requestId: generateRequestId,
products: {},
}
return JSON.stringify(body)
}
function generateRequestId(): string {
const uniqueId = generateRequestUniqueId()
const now = new Date().getTime()
return `${now}.aws-${uniqueId}`
}
function generateRandomString(length: number): string {
let result = ''
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * characters.length))
}
return result
}
function generateRequestUniqueId(): string {
return generateRandomString(2)
}
|