Skip to content

fix: correct BAD_REQUEST status code and deduplicate exception codes in OutputResponse#212

Open
Aarti-panchal01 wants to merge 1 commit into
PSMRI:mainfrom
Aarti-panchal01:fix/bad-request-status-code-in-output-response
Open

fix: correct BAD_REQUEST status code and deduplicate exception codes in OutputResponse#212
Aarti-panchal01 wants to merge 1 commit into
PSMRI:mainfrom
Aarti-panchal01:fix/bad-request-status-code-in-output-response

Conversation

@Aarti-panchal01
Copy link
Copy Markdown

📋 Description

Fixes incorrect HTTP status code constants in OutputResponse.java that affect every API response across HWC-API.

Problem 1: BAD_REQUEST = 404
BAD_REQUEST was set to 404 (Not Found) instead of 400 (Bad Request). This caused every bad request response to carry the semantically wrong HTTP status code, making it impossible to distinguish "resource not found" from "malformed request" errors.

Problem 2: Duplicate exception codes
SWYMED_EXCEPTION and TM_EXCEPTION both used error code 5010, making them completely indistinguishable in logs and error tracking systems.

Related to PSMRI/AMRIT#153

✅ Type of Change

  • 🐞 Bug fix

ℹ️ Additional Information

Changes — 1 file, 3 lines:

  • BAD_REQUEST: 404 → 400
  • SWYMED_EXCEPTION: 5010 → 5008
  • TM_EXCEPTION: 5010 → 5009

These constants are used across 20+ controllers in HWC-API.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Warning

Rate limit exceeded

@Aarti-panchal01 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 29 minutes and 29 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 08523b46-7e1d-43b4-8366-4a2468bdc70e

📥 Commits

Reviewing files that changed from the base of the PR and between 3861dd1 and 41327f6.

📒 Files selected for processing (1)
  • src/main/java/com/iemr/hwc/utils/response/OutputResponse.java
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Aarti-panchal01
Copy link
Copy Markdown
Author

Hi @drtechie and @sharma-sugurthi,

While working on the HTTP status fix in #153, found these incorrect constants in OutputResponse.java:

  • BAD_REQUEST was 404 (Not Found) — should be 400
  • SWYMED_EXCEPTION and TM_EXCEPTION both 5010 — indistinguishable in logs

1 file, 3 line fix but affects every controller in HWC-API.

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant