From 7e9932de0a6c0508ed4c8b382b6319e268d4db7b Mon Sep 17 00:00:00 2001 From: Thomas Nordquist Date: Mon, 4 Mar 2019 17:57:12 +0100 Subject: [PATCH] Show error when json formatting fails --- app/src/components/Sidebar/Publish/Publish.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/components/Sidebar/Publish/Publish.tsx b/app/src/components/Sidebar/Publish/Publish.tsx index f7fd6bd..17071c4 100644 --- a/app/src/components/Sidebar/Publish/Publish.tsx +++ b/app/src/components/Sidebar/Publish/Publish.tsx @@ -158,7 +158,9 @@ class Publish extends React.Component { try { const str = JSON.stringify(JSON.parse(this.props.payload), undefined, ' ') this.updatePayload(str) - } catch { } + } catch (error) { + this.props.globalActions.showError(`Format error: ${error.message}`) + } } } @@ -325,6 +327,7 @@ class Publish extends React.Component { const mapDispatchToProps = (dispatch: any) => { return { actions: bindActionCreators(publishActions, dispatch), + globalActions: bindActionCreators(globalActions, dispatch), } }