add error check for request

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2024-10-28 16:00:26 +01:00
parent a96664369b
commit 19b00f8c61

View File

@@ -52,6 +52,9 @@ public class TimezoneServiceImpl implements TimezoneService {
.get()
.uri("https://worldtimeapi.org/api/ip/" + ip)
.retrieve()
.onStatus(HttpStatusCode::is4xxClientError, (request, response) -> {
throw new NotFoundException();
})
.body(WorldTimeApiIpResponse.class);
}