Skip to content

Commit

Permalink
Fixes handling of MARC conversion errors.
Browse files Browse the repository at this point in the history
closes #2688
  • Loading branch information
justinlittman committed Oct 16, 2020
1 parent a5e389c commit ed13bf9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/editor/actions/MarcButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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()
}

Expand Down Expand Up @@ -89,7 +95,7 @@ const MarcButton = () => {
&& <div className="alert alert-danger" role="alert" style={{
marginLeft: '10px', marginRight: '10px', paddingLeft: '10px', paddingRight: '10px',
}}>
{ marcs.current[resourceKey].marc }
{ marcs.current[resourceKey].error }
</div>
}
</div>
Expand Down

0 comments on commit ed13bf9

Please sign in to comment.