From ed13bf9814742010a7e0960469fec7eb3a3019a3 Mon Sep 17 00:00:00 2001 From: Justin Littman Date: Fri, 16 Oct 2020 15:41:17 -0400 Subject: [PATCH] Fixes handling of MARC conversion errors. closes #2688 --- src/components/editor/actions/MarcButton.jsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/editor/actions/MarcButton.jsx b/src/components/editor/actions/MarcButton.jsx index 14475f24f..3fec617f3 100644 --- a/src/components/editor/actions/MarcButton.jsx +++ b/src/components/editor/actions/MarcButton.jsx @@ -27,7 +27,10 @@ const MarcButton = () => { marcs.current[resourceKey] = { marc: body, marcUrl: url } setRender(shortid.generate()) }) - .catch((err) => marcs.current[resourceKey] = { error: err.message || err }) + .catch((err) => { + marcs.current[resourceKey] = { error: err.message || err } + setRender(shortid.generate()) + }) } const handleRequest = (event) => { @@ -36,7 +39,10 @@ const MarcButton = () => { .then((marcJobUrl) => { marcJobTimer(marcJobUrl, resourceKey) }) - .catch((err) => marcs.current[resourceKey] = { error: err.message || err }) + .catch((err) => { + marcs.current[resourceKey] = { error: err.message || err } + setRender(shortid.generate()) + }) event.preventDefault() } @@ -89,7 +95,7 @@ const MarcButton = () => { &&
- { marcs.current[resourceKey].marc } + { marcs.current[resourceKey].error }
}