From e407976e58735ff460763fa0614eb7c933eadb76 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 20 Nov 2019 21:01:46 +0200 Subject: [PATCH] Journal Entries: make parse errors non-fatal here too. This is in continuation to 9abb3dcad9ce750e9e35257c2d5f51f31546068c. Fixes #48 --- src/components/JournalEntries.tsx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/components/JournalEntries.tsx b/src/components/JournalEntries.tsx index 73d04d2..4d1f12e 100644 --- a/src/components/JournalEntries.tsx +++ b/src/components/JournalEntries.tsx @@ -10,6 +10,7 @@ import Button from '@material-ui/core/Button'; import IconAdd from '@material-ui/icons/Add'; import IconDelete from '@material-ui/icons/Delete'; import IconEdit from '@material-ui/icons/Edit'; +import IconError from '@material-ui/icons/Error'; import * as ICAL from 'ical.js'; @@ -43,7 +44,26 @@ class JournalEntries extends React.PureComponent { } const entries = this.props.entries.map((syncEntry, idx) => { - const comp = new ICAL.Component(ICAL.parse(syncEntry.content)); + let parsed; + try { + parsed = ICAL.parse(syncEntry.content); + } catch (e) { + const icon = (); + return ( + { + this.setState({ + dialog: syncEntry.content, + }); + }} + /> + ); + } + const comp = new ICAL.Component(parsed); let icon; if (syncEntry.action === EteSync.SyncEntryAction.Add) {