fix: prefer registered error code#1920
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThree files are changed to fix error code precedence. In ChangesERROR_CODE Precedence Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. 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 |
Fixes #1919
When a custom error class defines its own
codefield, the runtime currently prefers that instance field over the key registered through.error(). That makesonError({ code })receive a value that does not match the typed registered error key.This changes both the AOT and dynamic error handlers to prefer the internal
ERROR_CODEregistration symbol, falling back toerror.codefor built-in errors and unregistered errors.Verification:
Summary by CodeRabbit
Bug Fixes