Let's say I have the following webflux snippet:
.map(str -> str.split(","))
.OnErrorResume(...)
I want to make sure that split returns an array of EXACTLY x items. Otherwise I want to go into the OnErrorResume
. Is there a webflux-y way to do that? filter
will just remove the bad items, but that isn't what I want.
Do I need to expand the map
to something like:
{
String[] arr = str.split(",");
if (arr.length != 3)
return Mono.error();
return arr;
}
Or is there something built in?