Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OH2-257 | Revise HTTP response codes in API #433

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

ArnaudFonzam
Copy link
Contributor

@ArnaudFonzam ArnaudFonzam commented Feb 16, 2024

See OH2-257.

@@ -123,13 +123,13 @@ public ResponseEntity<FullBillDTO> newBill(@RequestBody FullBillDTO newBillDto)
if (pat != null) {
bill.setBillPatient(pat);
} else {
throw new OHAPIException(new OHExceptionMessage("Patient not found."));
return ResponseEntity.badRequest().body(new OHExceptionMessage("Patient not found."));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find three different return values for something not found:

return ResponseEntity.badRequest().body("XXXX not found.");
return ResponseEntity.badRequest().body(new OHExceptionMessage("XXXX not found."));
return ResponseEntity.notFound().build();

Shouldn't there only be one form?

if (!admtManager.isCodePresent(code)) {
throw new OHAPIException(new OHExceptionMessage("Admission Type is not created."), HttpStatus.INTERNAL_SERVER_ERROR);
if (admtManager.isCodePresent(code)) {
return ResponseEntity.badRequest().body(new OHExceptionMessage("The code of Admission Type is already used."));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be two different returns for something already present/being used:

return ResponseEntity.badRequest().body(new OHExceptionMessage("XXXXX is already used."));
return ResponseEntity.internalServerError().body(new OHExceptionMessage("XXXXX is already present."));

Shouldn't there only be one?

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