Created
December 17, 2018 21:22
-
-
Save mchmielarz/77e317962414358c82cd09c72e2f340a to your computer and use it in GitHub Desktop.
Chained onFailure call
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Try.of(this::computation) | |
.onFailure(exc -> log.error("Computation failed!", exc)) | |
.andThen(this::storeInDb) | |
.onFailure(exc -> log.error("Storing in database failed!", exc)) | |
.andThen(this::sendEmail) | |
.onFailure(exc -> log.error("Email sending failed!", exc)) | |
.onSuccess(value -> log.info("Value computed, stored in db and sent in email")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment