From 75c0f2d292eb5a843c39bcb07e0932df86aab2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rialland?= Date: Thu, 24 Nov 2022 19:19:02 +0100 Subject: [PATCH] Fix script error --- site/scripts/fetch-job-offers.js | 5 ++++- site/scripts/fetch-stats.js | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/site/scripts/fetch-job-offers.js b/site/scripts/fetch-job-offers.js index b0c77d607..0c69f1ef4 100644 --- a/site/scripts/fetch-job-offers.js +++ b/site/scripts/fetch-job-offers.js @@ -24,7 +24,9 @@ async function fetchJobOffers() { // The XML API isn't the most ergonomic, we ought to have a JSON API. // cf. https://github.com/betagouv/beta.gouv.fr/issues/6343 - jobOffers = (await parseXML(content)).feed.entry + const xml = await parseXML(content) + + jobOffers = xml.feed.entry .map((entry) => ({ title: entry.title[0]['_'].trim(), link: entry.link[0].$.href, @@ -36,6 +38,7 @@ async function fetchJobOffers() { title: title.replace(' - Offre de Mon-entreprise', ''), })) } catch (err) { + console.error('Beta.gouv.fr/jobs error : ') console.error(err) } diff --git a/site/scripts/fetch-stats.js b/site/scripts/fetch-stats.js index c46ddefcd..18d5b27d3 100644 --- a/site/scripts/fetch-stats.js +++ b/site/scripts/fetch-stats.js @@ -395,6 +395,10 @@ async function fetchAllCrispConversations({ urlParams }) { isEndPagination = true } + if (paginatedData.message) { + console.error('Crisp error : ' + JSON.stringify(paginatedData)) + } + dataConversations.push(...(paginatedData || [])) pageCount++ } @@ -507,6 +511,11 @@ async function fetchZammadUserFeedbackIssues() { }), } ).then((r) => r.json()) + + if (tags.error) { + console.error('Zammad error: ' + JSON.stringify(tags)) + } + const issues = tags.filter(({ name }) => /#[\d]+/.exec(name)) return issues.reduce(