I've an external API call that may return an HTTP error, in some cases I want to stop the flow and on other to let it continue depending on the status, how can I "filter" a specific error?
Here's the code:
Mono<Void> call() {
service.find()
.filter{}
.flatMap {
otherService.find()
.doOnError {
if (it instanceof NotFound) {
// do not propagate the error and stop
}
// propagate the error
}
.flatMap{}.then()
}.then()
}
I've tried to use OnErrorContinue but the error is never matched:
.onErrorContinue({ it instanceof NotFound }, (err) -> {
log.info(err.message)
})
Try the following...