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 | 3x 4x 4x 4x 4x 4x 4x 4x 4x 24x 4x | export function generateErrorResponse(err: Error) {
return {
v: '2',
error: {
code: 'Failed',
message: `An error occured with Fingerprint Pro Azure function. Reason: ${err.message}`,
},
requestId: generateRequestId(),
products: {},
}
}
function generateRequestId(): string {
const uniqueId = generateRequestUniqueId()
const now = new Date().getTime()
return `${now}.${uniqueId}`
}
function generateRequestUniqueId(): string {
return generateRandomString(6)
}
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
}
|