I'm processing multiple records using Promise.all now if any error occurs I want to capture individual record in catch statement
I have written a method callApi now I'm calling callApi method in main code
try {
 let result = await callApi(res)
}
catch (err) {
}
async function callApi(records) {
  return Promise.all(
    records.map(async record => {
        await processRecord(record)
    })
  )
}
I want to display/capture individual record in catch block if any error occurs ex below
try {
 let result = await callApi(res)
}
catch (err) {
 console.log('Got error while processing this record', record)
}
But how I will get record variable in catch block
 
    