Skip to content

Commit

Permalink
chore: better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
irony committed Dec 4, 2024
1 parent ec5760a commit 1bd048d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/workers/nlmParsePDF.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ const nlmParsePDF = new DiscordWorker(
try {
json = await extractJsonFromPdf(pdf)
} catch (err) {
job.editMessage(`❌ Fel vid tolkning av PDF: ${err.message}`)
if (job.attemptsMade < (job.opts?.attempts || 10)) {
job.editMessage(
`❌ Fel vid tolkning av PDF: ${err.message}. Försöker igen om en stund...`
)
} else {
job.editMessage(
`❌ Fel vid tolkning av PDF: ${err.message}. Ger upp...`
)
}
throw new Error('Failed to parse PDF, retrying in one minute...')
} finally {
clearInterval(interval)
Expand Down

0 comments on commit 1bd048d

Please sign in to comment.