Repository navigation
feat(client): improve client instantiation error messages - #3441
nkaradzhov merged 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 910f288483
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 910f288. Configure here.
nkaradzhov
left a comment
There was a problem hiding this comment.
Thanks @AniaMakes — we'd like to keep the improved protocol error, but please drop the URL.canParse guard: it breaks supported unix://user:pass@/sock URLs, duplicates the TypeError that new URL already throws, and can leak passwords into error messages. The new test also passes on master, so remove or repurpose it. Your CONTRIBUTING.md complaint is valid; we'll fix that separately.
|
@nkaradzhov thank you for 👀 , done. Please let me know if you'd rather I cleaned up the commits so that there's only one. |
nkaradzhov
left a comment
There was a problem hiding this comment.
Thanks @AniaMakes this looks good. We will squash it on merge :)
|
@nkaradzhov Thank you, I'll leave you (or one of your colleagues) to merge as convenient; I don't appear to have the rights to do so. |

Description
We are using this module and have found that the errors could be a bit better.
This PR adds a check that the URL is actually a url, and improves the TypeError - invalid protocol - to include the protocol that it does see.
Please note that upon
npm iand thennpm tthe tests fail to run with a number ofMODULE_NOT_FOUNDmessages. Thenpm run build:tests-tools && npm testlisted in the Contributing guide result inMissing script: "build:tests-tools". Hopefully this PR is small enough to easily pass tests running on CI etc.Thank you in advance
Checklist
npm testpass with this change (including linting)?Note
Low Risk
String-only change to a validation error path in URL parsing; no connection or auth behavior changes.
Overview
When
createClient(orparseURL) is given a connection URL whose scheme is notredis:orrediss:, the client now throws aTypeErrorthat includes the actual protocol from the URL and states thatredis:orrediss:are expected.Previously the message was the generic
Invalid protocol, which made mis-typed schemes (e.g.redi://) harder to diagnose at instantiation time.Reviewed by Cursor Bugbot for commit b02620b. Bugbot is set up for automated code reviews on this repo. Configure here.