I’ve created a simple endpoint (quarkus-rest-jsonb: 3.10.2) to create a user. I’m calling the endpoint with an invalid email and expecting an validation error to return me a bad request 400 response. But I’m getting a 500 one.
Could someone tell me what am I missing ?
@POST
public Uni<RestResponse<UserDto>> create(@Valid UserNoIdDto userNoIdDto) {
if (userNoIdDto == null) {
throw new WebApplicationException(MSG_INVALID_PAYLOAD, 422);
}
return Panache.withTransaction(() -> userRepo.persist(mapper.toNoIdEntity(userNoIdDto)))
.map(created -> RestResponse.status(Status.CREATED, mapper.toDto(created)));
}
2024-06-01 08:43:30,546 ERROR [http-problem] (vert.x-eventloop-thread-3) status=500, title="Internal Server Error": org.hibernate.HibernateException: jakarta
.validation.ConstraintViolationException: Validation failed for classes [com.cvgaviao.api.app_mngt.entities.User] during persist time for groups [jaka
rta.validation.groups.Default, ]
List of constraint violations:[
ConstraintViolationImpl{interpolatedMessage='must be a well-formed email address', propertyPath=email, rootBeanClass=class com.cvgaviao.api.ap
p_mngt.entities.User, messageTemplate='{jakarta.validation.constraints.Email.message}'}
]
at org.hibernate.reactive.session.impl.ReactiveExceptionConverter.convert(ReactiveExceptionConverter.java:28)