Fix tests

This commit is contained in:
Hongbo Wu
2023-04-17 17:14:40 +08:00
parent 11538347af
commit a1e782e39d
2 changed files with 5 additions and 2 deletions

View File

@ -17,6 +17,7 @@ export const importCsv = async (ctx: ImportContext, stream: Stream) => {
// labels follows format: "[label1, label2]"
const labels = row.length > 2 ? row[2].slice(1, -1).split(',') : undefined
await ctx.urlHandler(ctx, url, state, labels)
ctx.countImported++
} catch (error) {
console.log('invalid url', row, error)
ctx.countFailed += 1

View File

@ -155,10 +155,12 @@ const urlHandler = async (
state,
labels
)
result ? ctx.countImported++ : ctx.countFailed++
if (!result) {
return Promise.reject('Failed to import url')
}
} catch (err) {
console.log('error importing url', err)
ctx.countFailed += 1
throw err
}
}