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 try catch to command #8381

Merged
merged 1 commit into from
Nov 7, 2024
Merged

Add try catch to command #8381

merged 1 commit into from
Nov 7, 2024

Conversation

martmull
Copy link
Contributor

@martmull martmull commented Nov 7, 2024

fixes 0-32 command

@martmull martmull marked this pull request as ready for review November 7, 2024 09:20
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 error handling to the webhook operation migration command to ensure robustness during the 0.32 version upgrade process.

  • Added try-catch block in /packages/twenty-server/src/database/commands/upgrade-version/0-32/0-32-copy-webhook-operation-into-operations-command.ts to handle workspace-level errors
  • Enhanced error logging with workspace ID and detailed error message for better debugging
  • Ensures migration continues for remaining workspaces even if one workspace fails

1 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +76 to +81
} catch (e) {
this.logger.log(
chalk.red(
`Error when running command on workspace ${workspaceId}: ${e}`,
),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider using logger.error() instead of logger.log() for error conditions. Also, error object might need toString() for proper serialization.


const [firstWebhookPart, lastWebhookPart] = newOpe.split('.');
const [firstWebhookPart, lastWebhookPart] = newOpe.split('.');
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Add null check for split() result - malformed operations could cause undefined lastWebhookPart

@charlesBochet charlesBochet merged commit f3a3867 into main Nov 7, 2024
19 checks passed
@charlesBochet charlesBochet deleted the fix-migration-command branch November 7, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants