Errors
This commit is contained in:
parent
92f1107e6c
commit
494a2ff91f
|
@ -17,6 +17,7 @@ const start = Date.now()
|
||||||
async function batchCreate(apiKey, appId, table, items, batchSize = 100) {
|
async function batchCreate(apiKey, appId, table, items, batchSize = 100) {
|
||||||
let i = 0
|
let i = 0
|
||||||
|
|
||||||
|
let errors = 0
|
||||||
async function createSingleRow(item) {
|
async function createSingleRow(item) {
|
||||||
try {
|
try {
|
||||||
const row = await createRow(apiKey, appId, table, item)
|
const row = await createRow(apiKey, appId, table, item)
|
||||||
|
@ -27,7 +28,7 @@ async function batchCreate(apiKey, appId, table, items, batchSize = 100) {
|
||||||
)
|
)
|
||||||
return row
|
return row
|
||||||
} catch {
|
} catch {
|
||||||
console.error("Error creating row", item)
|
errors++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +38,9 @@ async function batchCreate(apiKey, appId, table, items, batchSize = 100) {
|
||||||
const batchRows = await Promise.all(batchPromises)
|
const batchRows = await Promise.all(batchPromises)
|
||||||
rows.push(...batchRows)
|
rows.push(...batchRows)
|
||||||
}
|
}
|
||||||
|
if (errors) {
|
||||||
|
console.error(`Error creating ${errors} row`)
|
||||||
|
}
|
||||||
return rows
|
return rows
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue