exceptions
This commit is contained in:
parent
6f5a9771f0
commit
cf01392e65
2976
front/package-lock.json
generated
Normal file
2976
front/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -64,6 +64,7 @@ public class OrderRepositoryImpl implements OrderRepositoryExtension {
|
|||||||
currentOrder.addSession(orderSession);
|
currentOrder.addSession(orderSession);
|
||||||
currentSession.addOrder(orderSession);
|
currentSession.addOrder(orderSession);
|
||||||
currentSession.setCapacity(currentSession.getCapacity() - count);
|
currentSession.setCapacity(currentSession.getCapacity() - count);
|
||||||
|
em.merge(orderSession);
|
||||||
em.merge(currentSession);
|
em.merge(currentSession);
|
||||||
em.merge(currentOrder);
|
em.merge(currentOrder);
|
||||||
return orderRepository.findById(id);
|
return orderRepository.findById(id);
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.labwork1.app.util.error;
|
package com.labwork1.app.util.error;
|
||||||
|
|
||||||
|
import com.labwork1.app.student.service.CinemaNotFoundException;
|
||||||
import com.labwork1.app.student.service.CustomerNotFoundException;
|
import com.labwork1.app.student.service.CustomerNotFoundException;
|
||||||
import com.labwork1.app.student.service.OrderNotFoundException;
|
import com.labwork1.app.student.service.OrderNotFoundException;
|
||||||
|
import com.labwork1.app.student.service.SessionNotFoundException;
|
||||||
import com.labwork1.app.util.validation.ValidationException;
|
import com.labwork1.app.util.validation.ValidationException;
|
||||||
import org.springframework.context.support.DefaultMessageSourceResolvable;
|
import org.springframework.context.support.DefaultMessageSourceResolvable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@ -17,7 +19,10 @@ public class AdviceController {
|
|||||||
@ExceptionHandler({
|
@ExceptionHandler({
|
||||||
CustomerNotFoundException.class,
|
CustomerNotFoundException.class,
|
||||||
OrderNotFoundException.class,
|
OrderNotFoundException.class,
|
||||||
ValidationException.class
|
SessionNotFoundException.class,
|
||||||
|
CinemaNotFoundException.class,
|
||||||
|
ValidationException.class,
|
||||||
|
IllegalArgumentException.class
|
||||||
})
|
})
|
||||||
public ResponseEntity<Object> handleException(Throwable e) {
|
public ResponseEntity<Object> handleException(Throwable e) {
|
||||||
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
|
||||||
|
Loading…
Reference in New Issue
Block a user