fix: use valid HTTP status 500 instead of invalid 5000 in report error responses - #448
Conversation
…r responses CustomerRelationshipSecondaryReports controller returned ResponseEntity.status(5000) on generic exceptions across all report endpoints (including getAllByGender and getAllBySexualOrientation used by the 1097 report downloads). 5000 is not a valid three-digit HTTP status, so Spring throws IllegalArgumentException while building the response, which surfaces to clients as a confusing "Status code '5000' should be a three-digit positive integer" error instead of the actual failure reason. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|



Summary
CustomerRelationshipSecondaryReportsreturnedResponseEntity.status(5000)on generic exceptions across all secondary report endpoints (includinggetAllByGenderandgetAllBySexualOrientation, used by the 1097 report downloads).5000is not a valid three-digit HTTP status, so Spring throwsIllegalArgumentExceptionwhile building the response. That exception is caught by the globalValidationExceptionHandler, which surfaces a confusing"Status code '5000' should be a three-digit positive integer"error instead of the actual failure reason, with an HTTP 400.uatamrit.piramalswasthya.org) viaPOST /common-api/crmReports/getAllBySexualOrientation.Fix
Replace
ResponseEntity.status(5000)withResponseEntity.status(500)in every generic-exception branch of the affected report endpoints, matching the existing "No data found" branch which already used a valid500.Test plan
POST /common-api/crmReports/getAllBySexualOrientationwith a payload that previously triggered the generic-exception branch; confirm a clean 500 with the real error message instead of the malformed 5000/400 response.getAllByGender, etc.) for the same fix.