Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error handling service for calendar import #6203

Merged
merged 16 commits into from
Jul 12, 2024

Conversation

bosiraphael
Copy link
Contributor

Add error handling service for calendar import

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

  • Added CalendarEventImportErrorHandlerService to calendar-event-import-manager.module.ts
  • Introduced CALENDAR_THROTTLE_DURATION and CALENDAR_THROTTLE_MAX_ATTEMPTS constants
  • Removed syncCursor update logic from GoogleCalendarGetEventsService
  • Added parseGoogleCalendarError utility function
  • Created calendar-event-import-error-handling.service.ts for structured error handling

8 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Added handleError method in google-calendar-get-events.service.ts for robust error management
  • Introduced GoogleCalendarError type in google-calendar-error.type.ts for standardized error objects
  • Added parseGaxiosError utility in parse-gaxios-error.util.ts for mapping Gaxios errors
  • Updated parse-google-calendar-error.util.ts to use GoogleCalendarError type for better type safety

No major changes found since last review.

4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Removed calendarChannelRepository dependency in google-calendar-get-events.service.ts
  • Added error handling logic in getCalendarEvents method
  • Introduced utility function in parse-google-calendar-error.util.ts for parsing Google Calendar errors
  • Categorized errors into types like INSUFFICIENT_PERMISSIONS, TEMPORARY_ERROR, NOT_FOUND, and UNKNOWN

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Introduced CalendarEventImportSyncStep enum for standardized sync steps
  • Modified error handling logic to use the new enum
  • Added handleNotFoundError method for specific 'NOT_FOUND' error handling based on sync step

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Enhanced error handling for calendar event import
  • Utilized CalendarEventImportErrorHandlerService
  • Differentiated between full and partial fetches using CalendarEventImportSyncStep and CalendarChannelSyncStage enums

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Updated error handling in packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-events-import.service.ts
  • Replaced manual error creation with CalendarEventImportErrorHandlerService
  • Simplified error handling process for better maintainability

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Added markAsCompletedAndSchedulePartialMessageListFetch method in packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-channel-sync-status.service.ts
  • Integrated CalendarEventImportErrorHandlerService in packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-events-import.service.ts
  • Replaced schedulePartialCalendarEventListFetch with markAsCompletedAndSchedulePartialMessageListFetch in calendar-events-import.service.ts
  • Reset throttle failure count and sync stage start time in calendar-channel-sync-status.service.ts

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Added Kubernetes and Terraform configurations for deploying TwentyCRM (packages/twenty-docker/k8s/).
  • Enhanced error handling for link deletion in LinksFieldInput.tsx and LinksFieldMenuItem.tsx.
  • Updated absoluteUrlSchema.ts to allow empty strings as valid input.
  • Improved error handling in 0-22-update-boolean-fields-null-default-values-and-null-values.command.ts.
  • Removed WorkspaceGate decorator in connected-account.workspace-entity.ts.

32 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Updated cron pattern to run every minute (packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-event-list-fetch.cron.command.ts)
  • Enhanced error handling logic for Google Calendar API responses (packages/twenty-server/src/modules/calendar/calendar-event-import-manager/drivers/google-calendar/services/google-calendar-get-events.service.ts)

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Updated cron pattern to run every five minutes (packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-event-list-fetch.cron.command.ts)

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is way better! Just added a neat

@@ -90,4 +77,34 @@ export class GoogleCalendarGetEventsService {
nextSyncCursor: nextSyncToken || '',
};
}

private handleError(error: GaxiosError) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can improve the naming here as handleError is actually a throwCalendarEventError

) {
throw parseGaxiosError(error);
}
if (error.response?.status !== 410) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this if condition needs some details to be added. Why do we ignore 410? Also, it's preferrable to use a if (edgeCase) { return } pattern instead of if (!edgeCase) which leads to nested if / elses that are harder to read

throw parseGaxiosError(error);
}
if (error.response?.status !== 410) {
const googleCalendarError: GoogleCalendarError = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lastly, why do we do this construction here and not in parseGoogleCalendarError function?

@charlesBochet charlesBochet merged commit c8a8899 into main Jul 12, 2024
6 checks passed
@charlesBochet charlesBochet deleted the add-basic-error-handling-service branch July 12, 2024 16:56
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Added error handling service for calendar imports (packages/twenty-server/src/engine/core-modules/graphql/engine-graphql.module.ts, packages/twenty-server/src/engine/core-modules/graphql/hooks/use-graphql-error-handler.hook.ts)
  • Updated address fields to structured format across multiple modules (packages/twenty-server/src/database/typeorm-seeds/workspace/companies.ts, packages/twenty-server/src/modules/company/standard-objects/company.workspace-entity.ts)
  • Removed Timeline.tsx component (packages/twenty-front/src/modules/activities/timeline/components/Timeline.tsx)
  • Introduced isCancelDisabled prop to SaveAndCancelButtons component (packages/twenty-front/src/pages/settings/data-model/SettingsObjectEdit.tsx)
  • Enhanced Recoil and Apollo Client integration for activity creation (packages/twenty-front/src/modules/activities/hooks/useCreateActivityInDB.ts)

94 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants