Calendar: gracefully handle errors handling recurring events.

master
Tom Hacohen 4 years ago
parent 54c9735074
commit 1b50d197b1

@ -6,6 +6,8 @@ import { Calendar as BigCalendar, momentLocalizer, View } from "react-big-calend
import "react-big-calendar/lib/css/react-big-calendar.css"; import "react-big-calendar/lib/css/react-big-calendar.css";
import moment from "moment"; import moment from "moment";
import * as ICAL from "ical.js"; import * as ICAL from "ical.js";
import { store } from "../store";
import { appendError } from "../store/actions";
import { EventType } from "../pim-types"; import { EventType } from "../pim-types";
@ -55,6 +57,7 @@ class Calendar extends React.PureComponent<PropsType> {
this.props.entries.forEach((event) => { this.props.entries.forEach((event) => {
entries.push(event); entries.push(event);
try {
if (event.isRecurring()) { if (event.isRecurring()) {
const recur = event.iterator(); const recur = event.iterator();
@ -71,6 +74,9 @@ class Calendar extends React.PureComponent<PropsType> {
entries.push(ev); entries.push(ev);
} }
} }
} catch (e) {
store.dispatch(appendError(e));
}
}); });
return ( return (

Loading…
Cancel
Save