Added error checking for post calls
This commit is contained in:
@@ -48,6 +48,9 @@ public class LocationController {
|
||||
@PostMapping("")
|
||||
public ResponseEntity<LocationEntity> createLocation(@RequestBody LocationEntity location) {
|
||||
LocationEntity createdLocation = locationService.createLocation(location);
|
||||
if(createdLocation == null) {
|
||||
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
return new ResponseEntity<>(createdLocation, HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user