I have below code retuning Mono
try {
return userRepository.findById(id) // step 1
.flatMap(user -> barRepository.findByUserId( u
I think the first error is in the title: "Mono or Flux" is not related with the error handling.
To handle errors you can follow this example:
return webClient.get()
.uri(url)
.retrieve()
.bodyToMono(ModelYouAreRetrieving.class)
.doOnError(throwable -> logger.error("Failed for some reason", throwable))
.onErrorReturn(new ModelYouAreRetrieving(...))
.block();