quash-max
quash-max copied to clipboard
Fix #20: Revamp User Controller
Quash Pull Request
Description
This pull request refactors the UserController
by replacing the use of authentication.isAuthenticated() with exception handling using try-catch blocks. The goal is to enhance the robustness and stability of the controller by ensuring proper handling of potential authentication-related errors.
Fixes #20
Type of Change
Please check the relevant option(s)
- [x] ๐ Bug fix (non-breaking change addressing an issue)
- [ ] โจ New feature (non-breaking change adding functionality)
- [ ] ๐ฅ Breaking change (fix or feature causing existing functionality to not work as expected)
- [ ] ๐ Documentation update
- [x] ๐งน Code refactor
- [ ] ๐ง Build configuration change
- [ ] โก Performance improvement
- [ ] ๐งช Test update
Component
Please check the relevant option(s)
- [ ] ๐ฑ Android SDK
- [x] ๐ฅ๏ธ Backend
- [ ] ๐ Frontend
- [ ] ๐ Cross-component change
Changes Made
Provide a bullet-point list of the key changes made in this PR
- Replaced the existing logic that relied on authentication.isAuthenticated() with try-catch blocks.
- Added
NullPointerException
to handle cases where the authentication object might be null. - A general Exception catch block is added to handle any other unexpected errors.
- When exceptions are caught, appropriate error messages are returned to the client, with specific HTTP status codes (e.g., UNAUTHORIZED, INTERNAL_SERVER_ERROR).
How Has This Been Tested?
Describe the tests you ran to verify your changes. Provide instructions to reproduce and list any relevant details for your test configuration.
- [ ] Unit tests
- [ ] Integration tests
- [ ] Manual tests
Test Configuration:
- Quash SDK Version:
- Device/Environment:
- OS Version:
- Backend Version (if applicable):
- Frontend Version (if applicable):
Checklist
Please check all applicable items
- [ ] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation accordingly
- [ ] My changes generate no new warnings or errors
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [x] I have checked my code and corrected any misspellings
Additional Notes
Please review the changes and provide feedback. This refactor should not affect the functionality of the controller but is intended to make the code more robust and maintainable.
Screenshots (if appropriate)
If your changes include visual updates, please add before/after screenshots here.