complete level 5 track 1

This commit is contained in:
2026-10-15 13:04:16 +03:00
parent 9d0080db10
commit 4918969c6b
40 changed files with 877 additions and 53 deletions
@@ -12,6 +12,7 @@ import org.springframework.transaction.CannotCreateTransactionException;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingRequestHeaderException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@@ -138,6 +139,12 @@ public class GlobalExceptionHandler {
"Database error", req);
}
@ExceptionHandler(MissingRequestHeaderException.class)
public ResponseEntity<ErrorDTO> missingHeader(MissingRequestHeaderException e, HttpServletRequest req) {
return respond(HttpStatus.BAD_REQUEST, ErrorErrorDTO.CodeEnum.INVALID_REQUEST,
"Missing header: " + e.getHeaderName(), req);
}
private ResponseEntity<ErrorDTO> respond(HttpStatus status,
ErrorErrorDTO.CodeEnum code,
String message,