feat: add RateLimitException for NameCom adapter#61
Conversation
- Add new RateLimitException class to handle API rate limit errors - Update NameCom adapter to detect HTTP 429 and 'Rate Limit Exceeded' messages - Refactor exception handling to catch RateLimitException first before generic Exception - Add ERROR_RATE_LIMIT_EXCEEDED constant to error map
18ce9f8 to
9d7e2bd
Compare
WalkthroughThis pull request introduces rate-limit exception handling to the NameCom registrar adapter. A new Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
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 `@src/Domains/Registrar/Adapter/NameCom.php`:
- Around line 368-370: Cached entries for a reg type can be coerced to zero and
returned as new Price(...) leading to Price(0) instead of throwing
PriceNotFoundException; update the caching and lookup in NameCom (check the
$cached array for $regType and the presence/validity of the 'price'/'premium'
keys) so you never store or accept missing/invalid prices (do not cache
null/missing values), and when the cached entry is absent or its 'price' is not
set/valid, throw PriceNotFoundException instead of returning Price(0); adjust
the code paths that write the cache to skip saving missing prices and the lookup
that constructs new Price($cached[$regType]['price'],
$cached[$regType]['premium']) to validate keys first.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/Domains/Registrar/Adapter/NameCom.phpsrc/Domains/Registrar/Exception/RateLimitException.php
Summary
This PR adds support for detecting and handling rate limit errors from the NameCom API.
Changes
Technical Details
Testing
Rate limit exceptions are now properly caught and thrown, allowing applications to handle rate limiting appropriately (e.g., implement backoff strategies).
Summary by CodeRabbit
Release Notes
Bug Fixes
Improvements