From bec21c7b27c477216cb29ae760f001a3fa0b264c Mon Sep 17 00:00:00 2001 From: Henrique Pinheiro Date: Thu, 8 Feb 2024 08:14:57 -0300 Subject: [PATCH] feat(ocorrencias): Trata erro ao processar eml --- src/ocorrencia.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ocorrencia.ts b/src/ocorrencia.ts index f6ac4fd..9cbcdb3 100644 --- a/src/ocorrencia.ts +++ b/src/ocorrencia.ts @@ -90,8 +90,12 @@ await Promise.all([ ]) for (const { repositorio, kingdom, tag, url } of iptSources) { - console.debug(`Processing ${repositorio}:${tag}`) - const eml = await getEml(`${url}eml.do?r=${tag}`) + console.debug(`Processing ${repositorio}:${tag}\n${url}eml.do?r=${tag}`) + const eml = await getEml(`${url}eml.do?r=${tag}`).catch((error) => { + console.log('Erro baixando/processando eml', error.message) + return null + }) + if (!eml) continue const ipt = processaEml(eml) const dbVersion = ((await iptsCol.findOne({ _id: ipt.id })) as DbIpt | null) ?.version