Restore API error mapping for book placement failures
Type: API behavior
Priority: P1
Summary
Old controller mapped errors to HTTP status; new flow throws unchecked exceptions with no mapping.
Impact
500s for expected errors (book not found, shelf full, bad input).
Evidence
BookController.java now delegates; no exception handling.
@PostMapping("/{bookId}/shelf")
public ResponseEntity<HttpStatus> placeBookOnShelf(
@PathVariable Long bookId, @RequestBody BookShelfAssignmentRequest shelfAssignmentRequest) {
bookFacade.placeBookOnShelf(bookId, shelfAssignmentRequest);
return ResponseEntity.ok(HttpStatus.OK);
}
Proposed Fix
Add @ControllerAdvice or reintroduce explicit mapping.
Acceptance Criteria
- Errors map to 400/404/409 as appropriate.
Expected
Controller maps expected errors to correct HTTP status codes.
Actual
Unchecked exceptions bubble up as 500 for common error cases.
Restore API error mapping for book placement failures
Type: API behavior
Priority: P1
Summary
Old controller mapped errors to HTTP status; new flow throws unchecked exceptions with no mapping.
Impact
500s for expected errors (book not found, shelf full, bad input).
Evidence
BookController.javanow delegates; no exception handling.Proposed Fix
Add
@ControllerAdviceor reintroduce explicit mapping.Acceptance Criteria
Expected
Controller maps expected errors to correct HTTP status codes.
Actual
Unchecked exceptions bubble up as 500 for common error cases.