sitepodmatt
03/06/2019, 3:52 PMval remoteInput = Option.fromNullable(getRemoteInput())
val output = remoteInput
.toEither { Exception("No input") }
.flatMap { input ->
if(input.isNullOrBlank()) Exception("Blank input").left() else input.trim().right()
}
.handleErrorWith {
// do some logging
Option.fromNullable(getAlternativeRemoteInput()).toEither { Exception("No input")}... and so on
}