fix(fileimport service): prevent fatal crash when send results (#4970)

This commit is contained in:
Iain Sproat
2025-06-20 16:00:58 +01:00
committed by GitHub
parent d486ffc09a
commit 7d0f598b3a
@@ -82,17 +82,22 @@ export const main = async () => {
}
if (err instanceof Error) {
encounteredError = true
done(err)
await sendResult({
...job,
result: {
status: 'error',
reason: err.message,
try {
await sendResult({
...job,
result: {
durationSeconds: 0
status: 'error',
reason: err.message,
result: {
durationSeconds: 0
}
}
}
})
})
} catch (sendErr) {
jobLogger.fatal({ err: sendErr }, 'Failed to send result for job {jobId}')
} finally {
done(err)
}
} else {
throw err
}