Added error checking for post calls

This commit is contained in:
grata
2023-04-27 16:12:49 +02:00
parent 33c2f8bf8a
commit 9b6cfc4fe2
9 changed files with 84 additions and 4 deletions

View File

@@ -48,6 +48,9 @@ public class WaypointController {
@PostMapping("")
public ResponseEntity<WaypointsEntity> createWaypoint(@RequestBody WaypointsEntity waypoint) {
WaypointsEntity createdWaypoint = waypointService.createWaypoint(waypoint);
if (createdWaypoint == null) {
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity<>(createdWaypoint, HttpStatus.CREATED);
}