Resolve if can't find event on google cal (#2860)

* Resolve if can't find event on google cal

* Change order of  console.error

Co-authored-by: Omar López <zomars@me.com>

Co-authored-by: Omar López <zomars@me.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
pull/2880/head^2
Joe Au-Yeung 2022-05-25 10:29:38 -04:00 committed by GitHub
parent 07aa2e88a1
commit e16eee68b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 5 deletions

View File

@ -102,10 +102,13 @@ export default class GoogleCalendarService implements Calendar {
dateTime: calEventRaw.endTime,
timeZone: calEventRaw.organizer.timeZone,
},
attendees: [{...calEventRaw.organizer, organizer: true }, ... calEventRaw.attendees.map((attendee) => ({
...attendee,
responseStatus: "accepted",
}))],
attendees: [
{ ...calEventRaw.organizer, organizer: true },
...calEventRaw.attendees.map((attendee) => ({
...attendee,
responseStatus: "accepted",
})),
],
reminders: {
useDefault: true,
},
@ -235,8 +238,10 @@ export default class GoogleCalendarService implements Calendar {
},
function (err: GoogleCalError | null, event) {
if (err) {
if (err.code === 410) resolve();
/* 410 is when an event is already deleted on the Google cal before on cal.com
404 is when the event is on a different calendar */
console.error("There was an error contacting google calendar service: ", err);
if (err.code === (410 || 404)) return resolve();
return reject(err);
}
return resolve(event?.data);