feat: enhance exception handling with standardized error codes#155
feat: enhance exception handling with standardized error codes#155ArnabChatterjee20k wants to merge 2 commits intomainfrom
Conversation
Added new constants for common HTTP error codes in the Exception class. Updated various parts of the codebase to utilize these constants for improved error handling, including specific validation and internal error messages in the Appwrite, JSON, and CSV source and destination classes.
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds HTTP-like error code constants to Migration\Exception and updates exception construction across migration sources, destinations, and Target to include explicit numeric codes and preserve original exceptions as previous throwables. Specific changes set CODE_VALIDATION, CODE_INTERNAL, and other codes on validation, encoding, transfer, and HTTP error cases in CSV, JSON, Appwrite, and Target logic. Also sets a MigrationException code on JSON encoding failures. Messages and control flow are preserved while exceptions carry structured codes and proper chaining. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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/Migration/Sources/Appwrite.php`:
- Around line 209-213: The 403 branch currently throws a new Exception without
preserving the original code or previous exception; update the branch in
Appwrite.php so the thrown exception includes the 403 status code and the
original exception as the previous (mirror how the else branch forwards
$e->getCode() and $e as previous). Locate the conditional that checks if
($e->getCode() === 403) and change the throw to include the code and $e as the
previous exception so callers see the standardized code and original stack.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cd4a39a7-c212-4cf1-995d-91ad6eeed953
📒 Files selected for processing (7)
src/Migration/Destinations/Appwrite.phpsrc/Migration/Destinations/JSON.phpsrc/Migration/Exception.phpsrc/Migration/Sources/Appwrite.phpsrc/Migration/Sources/CSV.phpsrc/Migration/Sources/JSON.phpsrc/Migration/Target.php
Added new constants for common HTTP error codes in the Exception class. Updated various parts of the codebase to utilize these constants for improved error handling, including specific validation and internal error messages in the Appwrite, JSON, and CSV source and destination classes.
Summary by CodeRabbit
Bug Fixes
Refactor