Skip to content

fix: enhance UI error handling with HTTP codes#79

Open
harrshita123 wants to merge 1 commit intoPSMRI:developfrom
harrshita123:fix/issue-113
Open

fix: enhance UI error handling with HTTP codes#79
harrshita123 wants to merge 1 commit intoPSMRI:developfrom
harrshita123:fix/issue-113

Conversation

@harrshita123
Copy link
Copy Markdown

@harrshita123 harrshita123 commented May 5, 2026

📋 Description

JIRA ID: PSMRI/AMRIT#113

Because the backend (ECD-API) is being updated to return proper REST HTTP status codes (400, 401, 500) instead of hiding errors inside a 200 OK response, our frontend HTTP Interceptor needed to be updated to catch these new responses correctly.

This PR refactors http-interceptor.service.ts:

  • Removed the legacy check for custom internal status codes (like 5002) inside successful responses.
  • Enhanced the catchError pipeline to properly intercept standard HttpErrorResponse objects.
  • It now cleanly wipes sessionStorage and redirects to the login page on 401 Unauthorized or 403 Forbidden errors.
  • It maps standard 400 validation errors and 500 server errors to our user-friendly dialogue popups.

✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Testing & Context:

  • Built the frontend locally (ng build --configuration=production) to ensure the updated interceptor didn't introduce any strict TypeScript typing errors.
  • The catchError logic was streamlined using standard if/else checks and an Array.some() method for excluded endpoints to keep the interceptor fast and performant.
  • Ensure that the companion PR in ECD-API is merged, as this UI update directly relies on the backend returning standard HTTP codes.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d35de6b1-9a50-4297-9668-e8c793723837

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

@drtechie drtechie requested a review from snehar-nd May 6, 2026 09:31
@drtechie
Copy link
Copy Markdown
Member

drtechie commented May 6, 2026

Removed the legacy check for custom internal status codes (like 5002) inside successful responses.

does this really work? A lot of APIs respond with SUCCESS 200 OK, but still has errors inside the data.

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.

2 participants