Skip to content

Conversation

rkistner
Copy link
Contributor

@rkistner rkistner commented Jan 9, 2025

The goal is to introduce consistent error codes throughout the entire service stack, in the form of PSYNC_Sxxxx for service errors, and PSYNC_Rxxxx for sync rules errors.

This refactors the error classes a bit to support this, and refactors an initial set of errors to use this new format. There are many cases not covered yet - can improve that over time.

The service-errors package contains a script to generate documentation for error codes from the source - see example here. This can be tweaked over time.

Some specific error messages have been improved:

  1. MongoDB "Test Connection" error messages - many of them now provide more specific messages. This also added some checks that the user has sufficient privileges. This does not cover the same errors when running the service yet.
  2. Fix sync rules value.get is not a function when having an empty bucket (shows better error message now).

There is now a "test-connection" action on the entry point that does the same connection validation as on the cloud service, which is also useful to test these error message changes.

Copy link

changeset-bot bot commented Jan 9, 2025

🦋 Changeset detected

Latest commit: 297d709

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@powersync/service-core Patch
@powersync/service-image Patch
@powersync/service-sync-rules Patch
@powersync/service-module-mongodb Patch
@powersync/service-module-postgres-storage Patch
@powersync/service-module-mongodb-storage Patch
@powersync/service-module-postgres Patch
@powersync/service-rsocket-router Patch
@powersync/service-errors Patch
@powersync/service-module-mysql Patch
@powersync/lib-service-postgres Patch
@powersync/lib-services-framework Patch
@powersync/lib-service-mongodb Patch
@powersync/service-core-tests Patch
test-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rkistner rkistner marked this pull request as ready for review January 21, 2025 15:12
@rkistner rkistner requested a review from benitav January 21, 2025 15:28
stevensJourney
stevensJourney previously approved these changes Jan 22, 2025
Copy link
Collaborator

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

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

Had some minor comments, but looks good overall to me.

@rkistner rkistner merged commit f049aa9 into main Jan 22, 2025
16 checks passed
@rkistner rkistner deleted the error-codes branch January 22, 2025 14:22
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