Created
December 21, 2019 15:03
-
-
Save jnizet/492c0f796e6dc54e48a3ed1772368267 to your computer and use it in GitHub Desktop.
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
public Pojo parseJson(String json) { | |
// parse | |
return pojo; | |
// don't catch the exception. If there is an exception, there is a bug, so you shouldn't catch it and ignore it | |
// that will only cause a cryptic NullPointerException later. | |
} | |
public Mono<Pojo> query(long id) { | |
Integer value = idMapper.getValue(id); | |
if (value != null) { | |
return repo.query(value).map(this::parse); | |
} | |
return Mono.error(() -> new NotFoundException("No Pojo with ID could be found")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment