Search in sources :

Example 1 with FieldErrorDTO

use of py.org.fundacionparaguaya.pspserver.common.dtos.FieldErrorDTO in project FP-PSP-SERVER by FundacionParaguaya.

the class ExceptionTranslatorAdvice method handleCustomParameterizedValidationError.

@ExceptionHandler(CustomParameterizedException.class)
public ResponseEntity<Object> handleCustomParameterizedValidationError(CustomParameterizedException ex) {
    List<FieldErrorDTO> fieldErrors = ex.getFieldErrors();
    ErrorDTO dto = ErrorDTO.of(ex.getLocalizedMessage());
    dto.addFieldErrors(fieldErrors);
    return generateResponseEntity(dto, HttpStatus.BAD_REQUEST);
}
Also used : FieldErrorDTO(py.org.fundacionparaguaya.pspserver.common.dtos.FieldErrorDTO) FieldErrorDTO(py.org.fundacionparaguaya.pspserver.common.dtos.FieldErrorDTO) ErrorDTO(py.org.fundacionparaguaya.pspserver.common.dtos.ErrorDTO) ExceptionHandler(org.springframework.web.bind.annotation.ExceptionHandler)

Aggregations

ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)1 ErrorDTO (py.org.fundacionparaguaya.pspserver.common.dtos.ErrorDTO)1 FieldErrorDTO (py.org.fundacionparaguaya.pspserver.common.dtos.FieldErrorDTO)1