Repository navigation
fix(nurse): show server message when general OPD nurse save fails - #290
Open
Aarti-panchal01 wants to merge 1 commit into
Open
Aarti-panchal01 wants to merge 1 commit into
Aarti-panchal01 wants to merge 1 commit into
Conversation
The error callback for saveNurseGeneralOPDDetails passed the whole HttpErrorResponse to the alert dialog, which rendered [object Object]. Show err.error.errorMessage instead, falling back to common.unableSave. Pairs with PSMRI/HWC-API#211, which makes save/nurseData return real HTTP status codes. The success-path statusCode check is unchanged, so both response shapes work and merge order does not matter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
|
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



📋 Description
JIRA ID:
Pairs with PSMRI/HWC-API#211, which makes
generalOPD/save/nurseDatareturn real HTTP status codes instead of always 200.Once that lands, a failed General OPD nurse save comes back as HTTP 500 with the usual
{statusCode, errorMessage, status}body. Angular routes that to the subscriber's error callback. That callback passed the wholeHttpErrorResponsetoconfirmationService.alert(), so the nurse saw an error dialog reading[object Object].The error callback in
submitNurseGeneralOPDVisitDetailsnow showserr.error.errorMessage. If the body has no message (for example, Spring's default error body from an uncaught exception), it falls back to the existingcommon.unableSavetranslation, which is present in English, Hindi, Kannada and Assamese. The success-pathres.statusCode === 200check is unchanged.Merge order does not matter. HWC-UI now handles both response shapes:
Forced logout is unaffected. Session errors (5002, or the Redis session message) are written as HTTP 200 by HWC-API's
HTTPRequestInterceptor.preHandle, before the controller runs.JwtUserIdValidationFilteralready returns a real 401. #211 doesn't touch either path, andtoStringWithHttpStatus()never emits 401 or 403, soHttpInterceptorServicesees the same statuses as before.Scope: only the
save/nurseDatacallback. The samealert(err, 'error')pattern exists in other callbacks in this component, including the General OPD doctor save (save/doctorData) and update (update/doctorData). They're left alone because #211 only convertssave/nurseData. They should change together with their backend endpoints.✅ Type of Change
ℹ️ Additional Information
How this was tested:
ng build --configuration=production(AOT) passes..eslintrc.json, includingprettier/prettier) is clean on the changed file, and the husky lint-stagedeslint --fixhook passed on commit.ng testcannot run onmaintoday. The spec bundle fails to compile with 119 TypeScript errors in existing spec files and mocks (search.component.spec.ts,vitals.component.spec.ts,examination.component.spec.ts, and others), plus a duplicategetUserIdkey inenvironment.test.ts. I checked this branch and untouchedmain: both give the same 119 errors, and none of them are inworkarea.component.ts.workarea.component.tshas no spec file.🤖 Generated with Claude Code