-
Notifications
You must be signed in to change notification settings - Fork 8
fix(utils/errors): correct typo in error class name #49
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughRenames the exported error class from InavlidParametersError to InvalidParametersError and updates its internal name string in src/utils/errors.ts. No other exports or files are modified. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/utils/errors.ts (2)
11-13
: Make stack handling resilient when innerError.stack is missingConcatenating to this.stack can yield "undefined\n..." on environments where Error.stack isn’t set. Use a safe join.
- if (innerError) { - this.stack += `\nCaused by: ${innerError.stack}`; - } + if (innerError) { + const causeStack = innerError.stack ?? `${innerError.name}: ${innerError.message}`; + this.stack = [this.stack, `Caused by: ${causeStack}`].filter(Boolean).join('\n'); + }
28-28
: Naming consistency: InvalidParamError vs InvalidParametersErrorThere are two similarly named errors: InvalidParamError (singular) and InvalidParametersError (plural). Consider consolidating or clarifying intent via JSDoc to reduce ambiguity for consumers.
Also applies to: 39-39
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/utils/errors.ts
(1 hunks)
🔇 Additional comments (1)
src/utils/errors.ts (1)
39-39
: Typo fix on exported error class — LGTMRenaming the export to InvalidParametersError is correct and aligns with conventional naming.
export const InvalidParametersError = createErrorClass('InvalidParametersError'); | ||
export const ProofSubmissionFailedError = createErrorClass('ProofSubmissionFailedError'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Preserve backward compatibility with a deprecated alias
Downstream users may currently import/compare against the misspelled InavlidParametersError. To avoid a breaking change, keep a deprecated alias that points to the same class object.
Apply this minimal, non-breaking alias:
export const InvalidParametersError = createErrorClass('InvalidParametersError');
+/** @deprecated Use InvalidParametersError (fixed spelling). This alias will be removed in a future major release. */
+export const InavlidParametersError = InvalidParametersError;
export const ProofSubmissionFailedError = createErrorClass('ProofSubmissionFailedError');
Run this quick check to find internal usages that still reference the old name or compare error.name to the misspelled string:
🏁 Script executed:
#!/bin/bash
# Find symbol imports/usages of the old misspelling
rg -nP -C2 '\bInavlidParametersError\b' --type ts --type tsx --type js --type jsx -g '!**/dist/**'
# Find string comparisons against the old error name
rg -nP -C2 'error\.name\s*===\s*["'\'']InavlidParametersError["'\'']' --type ts --type tsx --type js --type jsx -g '!**/dist/**'
Length of output: 287
🏁 Script executed:
#!/bin/bash
# Search for misspelled alias usage in source files
rg -nP -C2 '\bInavlidParametersError\b' --glob '*.ts' --glob '*.tsx' --glob '*.js' --glob '*.jsx' --glob '!**/dist/**'
# Search for string comparisons against the misspelled error name
rg -nP -C2 'error\.name\s*===\s*["'\'']InavlidParametersError["'\'']' --glob '*.ts' --glob '*.tsx' --glob '*.js' --glob '*.jsx' --glob '!**/dist/**'
Length of output: 2336
Preserve backward compatibility by adding a deprecated alias for the misspelled error
The codebase still imports and throws InavlidParametersError
in src/utils/validationUtils.ts, so adding a deprecated alias is required to avoid breaking those references. Once downstream and internal imports have been updated to the correctly spelled InvalidParametersError
, the alias can be removed in a future major release.
Locations needing attention:
- src/utils/errors.ts: add the alias
- src/utils/validationUtils.ts: current imports and throws reference the misspelling
Suggested change:
export const InvalidParametersError = createErrorClass('InvalidParametersError');
+/** @deprecated Use InvalidParametersError (fixed spelling). This alias will be removed in a future major release. */
+export const InavlidParametersError = InvalidParametersError;
export const ProofSubmissionFailedError = createErrorClass('ProofSubmissionFailedError');
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export const InvalidParametersError = createErrorClass('InvalidParametersError'); | |
export const ProofSubmissionFailedError = createErrorClass('ProofSubmissionFailedError'); | |
export const InvalidParametersError = createErrorClass('InvalidParametersError'); | |
/** @deprecated Use InvalidParametersError (fixed spelling). This alias will be removed in a future major release. */ | |
export const InavlidParametersError = InvalidParametersError; | |
export const ProofSubmissionFailedError = createErrorClass('ProofSubmissionFailedError'); |
🤖 Prompt for AI Agents
In src/utils/errors.ts around lines 39-40, preserve backward compatibility by
exporting a deprecated alias named InavlidParametersError pointing to the
correctly spelled InvalidParametersError: add a single line that assigns and
exports InavlidParametersError = InvalidParametersError and include a //
deprecated comment referencing the correct name and a TODO to remove in the next
major release; do not change existing imports in src/utils/validationUtils.ts so
current throws keep working.
Fixed typo in src/utils/errors.ts:
Renamed InavlidParametersError → InvalidParametersError.
Summary by CodeRabbit
Bug Fixes
Refactor