feat(calendar): add error tracking with attempts to SelectedCalendar (#21326)

Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Hariom Balhara <[email protected]>
Co-authored-by: Omar López <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-05-23 16:38:54 +00:00
1 parent bca46228e7
commit 3a8e40d029
7 files changed
+146 -32

No files matched your search

@@ -974,15 +974,13 @@ export default class GoogleCalendarService implements Calendar {
expiration: otherCalendarsWithSameSubscription[0].googleChannelExpiration,
}
: {};
let error: string | null = null;
if (!otherCalendarsWithSameSubscription.length) {
try {
googleChannelProps = await this.startWatchingCalendarsInGoogle({ calendarId });
} catch (_error) {
this.log.error(`Failed to watch calendar ${calendarId}`, _error);
// We set error to prevent attempting to watch on next cron run
error = _error instanceof Error ? _error.message : "Unknown error";
} catch (error) {
this.log.error(`Failed to watch calendar ${calendarId}`, safeStringify(error));
throw error;
}
} else {
logger.info(
@@ -1000,7 +998,6 @@ export default class GoogleCalendarService implements Calendar {
googleChannelResourceId: googleChannelProps.resourceId,
googleChannelResourceUri: googleChannelProps.resourceUri,
googleChannelExpiration: googleChannelProps.expiration,
error,
},
eventTypeIds
);