editCategory wirft 404 bei falscher categoryID

This commit is contained in:
Technoir committed 2026-10-11 13:37:59 +02:00
1 parent 9fa60a8d6d
commit 6f503f311e
1 file changed
+1 -1
@@ -52,7 +52,7 @@ public class ShoppingCategoryController {
@PatchMapping("/api/categories/{categoryID}")
public ResponseEntity<Void> editCategory(@PathVariable UUID categoryID,@RequestBody ShoppingCategoryPatchDTO toChange){
ShoppingCategory category = shoppingCategoryRepository.findById(categoryID).orElseThrow();
ShoppingCategory category = shoppingCategoryRepository.findById(categoryID).orElseThrow(() -> new ResourceNotFoundException("categoryID",categoryID));
if(toChange.categoryName() != null) category.setCategoryName(toChange.categoryName());