1 package fr.tiogars.chat.domains.taxonomy;
2
3 import fr.tiogars.chat.domains.tag.controllers.TagController;
4 import fr.tiogars.chat.domains.nomenclature.controllers.NomenclatureController;
5 import org.springframework.dao.DataIntegrityViolationException;
6 import org.springframework.http.ResponseEntity;
7 import org.springframework.web.bind.annotation.ExceptionHandler;
8 import org.springframework.web.bind.annotation.RestControllerAdvice;
9
10 @RestControllerAdvice(assignableTypes = {TagController.class, NomenclatureController.class})
11 public class TaxonomyConflictHandler {
12 @ExceptionHandler(DataIntegrityViolationException.class)
13 public ResponseEntity<Void> conflict(DataIntegrityViolationException exception) {
14 return ResponseEntity.status(409).build();
15 }
16 }