feat(transloco): add TranslationLoadError class for translation load failures#906
Conversation
📝 WalkthroughWalkthroughAdds a new exported error class Changes
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
@jsverse/transloco
@jsverse/transloco-locale
@jsverse/transloco-messageformat
@jsverse/transloco-optimize
@jsverse/transloco-persist-lang
@jsverse/transloco-persist-translations
@jsverse/transloco-preload-langs
@jsverse/transloco-schematics
@jsverse/transloco-scoped-libs
@jsverse/transloco-utils
@jsverse/transloco-validator
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@libs/transloco/src/lib/transloco.service.ts`:
- Around line 92-105: The error message in the TranslationLoadError constructor
contains a grammatical typo ("did you misspelled the scope name?"); update the
message assembly in the TranslationLoadError constructor (when isScope is true)
to use the correct form, e.g. "did you misspell the scope name?" so the thrown
error text is grammatically correct and still includes the scope hint.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ee8ff0e0-f1f4-41e9-845e-6ecef653857f
📒 Files selected for processing (2)
libs/transloco/src/index.tslibs/transloco/src/lib/transloco.service.ts
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="libs/transloco/src/lib/transloco.service.ts">
<violation number="1" location="libs/transloco/src/lib/transloco.service.ts:100">
P3: Grammar error: "did you misspelled" should be "did you misspell". Since this is a user-facing error message, it's worth fixing.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…failures Replace the generic Error thrown in handleFailure with a dedicated TranslationLoadError class. The new class exposes structured metadata (lang, fallbackLangs, isScope) for easier error handling and logging, and sets a descriptive name property for clearer stack traces.
b5e4505 to
4d8bc35
Compare
|
@arturovt Netanel isn't part of this project for a long time now. |
|
@shaharkazaz do you have a slack where we could chat or may be google chat? |
|
X, google, discord all are fine |
|
sent you a message on google chat |
Replace the generic Error thrown in handleFailure with a dedicated TranslationLoadError class. The new class exposes structured metadata (lang, fallbackLangs, isScope) for easier error handling and logging, and sets a descriptive name property for clearer stack traces.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Summary by cubic
Add
TranslationLoadErrorfor failed translation loads, replacing the genericError. Exposeslang,fallbackLangs, andisScopefor clearer debugging and handling.TranslationLoadError(lang, fallbackLangs, isScope)with a descriptive message andname; hints at scope typos when relevant.TranslocoServicewhen all fallbacks fail; exported fromindex.tsfor app-level handling.Written for commit 1fc5306. Summary will update on new commits.
Summary by CodeRabbit