``` val remoteInput = Option.fromNullable(getRemo...
# arrow
s
Copy code
val 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
            }