see the @ControllerAdvice https://docs.spring.io/spring-framework/reference/web/webflux/controller/ann-advice.html. In your endpoint you send the valid case and for other problem you throw an error and handle with the controller advice