From ac135c9fa0e7d06b2b0912061538b989fd06799e Mon Sep 17 00:00:00 2001 From: Andres Sebastian Rudqvist Date: Sat, 11 Apr 2020 22:32:53 -0500 Subject: [PATCH 1/2] =?UTF-8?q?Add=20try-catch=20to=20the=20footer=20parsi?= =?UTF-8?q?ng=20methods=E2=80=94issue=20836.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/framework/footer.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/framework/footer.js b/src/components/framework/footer.js index 59d07601f..efbe55cd7 100644 --- a/src/components/framework/footer.js +++ b/src/components/framework/footer.js @@ -162,8 +162,18 @@ export const getAcknowledgments = (metadata, dispatch) => { KEEP_CONTENT: false, ALLOW_DATA_ATTR: false }; - const rawDescription = marked(metadata.description); - const cleanDescription = sanitizer(rawDescription, sanitizerConfig); + + + let cleanDescription; + try + { + const rawDescription = marked(metadata.description); + cleanDescription = sanitizer(rawDescription, sanitizerConfig); + } catch (error) { + console.error(`Error parsing footer description: ${error}`) + cleanDescription = (

Something went wrong.

); + } + return (
Date: Sat, 11 Apr 2020 22:55:03 -0500 Subject: [PATCH 2/2] Modified error message --- src/components/framework/footer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/framework/footer.js b/src/components/framework/footer.js index efbe55cd7..163c27aa3 100644 --- a/src/components/framework/footer.js +++ b/src/components/framework/footer.js @@ -170,8 +170,8 @@ export const getAcknowledgments = (metadata, dispatch) => { const rawDescription = marked(metadata.description); cleanDescription = sanitizer(rawDescription, sanitizerConfig); } catch (error) { - console.error(`Error parsing footer description: ${error}`) - cleanDescription = (

Something went wrong.

); + console.error(`Error parsing footer description: ${error}`); + cleanDescription = (

There was an error parsing the footer description.

); } return (