-
Notifications
You must be signed in to change notification settings - Fork 67
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
base: develop
Are you sure you want to change the base?
Conversation
@@ -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.")); |
There was a problem hiding this comment.
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.")); |
There was a problem hiding this comment.
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?
See OH2-257.