opencv/src/main/java/pl/edu/amu/wmi/bookapi/exceptions/ExceptionHandlerFilter.java

16 lines
547 B
Java

package pl.edu.amu.wmi.bookapi.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
@ControllerAdvice
public class ExceptionHandlerFilter {
@ExceptionHandler(RegisterException.class) public ResponseEntity handleDuplicateUserName() {
return ResponseEntity
.status(HttpStatus.BAD_REQUEST)
.body("Cannot use this username");
}
}