Skip to content

Instantly share code, notes, and snippets.

@piotrmadry
Created January 7, 2019 19:44
Show Gist options
  • Save piotrmadry/90a274f94b49c16b5efd8ff13190183d to your computer and use it in GitHub Desktop.
Save piotrmadry/90a274f94b49c16b5efd8ff13190183d to your computer and use it in GitHub Desktop.
fun <T> Single<T>.toEither(): Single<Either<DefaultError, T>> = this
.map<Either<DefaultError, T>> { Either.right(it) }
.onErrorReturn { Either.left(it.toDefaultError()) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment