Skip to content

feat: improve error formating for service errors#33

Merged
stevensJourney merged 1 commit intomainfrom
log-captures
Mar 18, 2026
Merged

feat: improve error formating for service errors#33
stevensJourney merged 1 commit intomainfrom
log-captures

Conversation

@stevensJourney
Copy link
Collaborator

While executing commands, we try to catch all possible error conditions which may occur. We attempt to convey at which step of command execution the error occurred and, if possible, add some suggestions for potential fixes.

If we make a request to one of our backend services, the standard backend client's approach is to throw an exception of the form JourneyError. This error can contain information specific to the request's error e.g. auth issues or service side exceptions.

When we receive a JourneyError, we currently display the raw JSON content of the Journey specific error. See the example below:

❯ powersync login
✔ Would you like to open a browser to generate a token? No
✔ Enter your API token (https://docs.powersync.com/usage/tools/cli#personal-access-token): *********
Testing token...
Error: Invalid token. Please try again., :: {
        "status": 401,
        "code": "ACCESS_DENIED",
        "description": null,
        "details": null,
        "stack": {},
        "name": "JourneyError"
}

This updates the log format slightly:

  • The term JourneyError is replaced with PowerSyncError.
  • For authentication errors, we display PowerSyncAuthError with a hint that the PAT token might be invalid.
❯ powersync login
✔ Would you like to open a browser to generate a token? No
✔ Enter your API token (https://docs.powersync.com/usage/tools/cli#personal-access-token): ***************
Testing token...
Error: Invalid token. Please try again., :: {
        "status": 401,
        "code": "ACCESS_DENIED",
        "description": null,
        "details": null,
        "stack": {},
        "name": "PowerSyncAuthError",
        "category": "authentication",
        "hint": "Authentication failed. Your PAT TOKEN might be invalid — run `powersync login` to refresh."
}

@stevensJourney stevensJourney marked this pull request as ready for review March 18, 2026 13:09
@stevensJourney stevensJourney merged commit c5ae2d5 into main Mar 18, 2026
3 checks passed
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