From deafa70552ae091bb45497bda12276bd18da4f44 Mon Sep 17 00:00:00 2001 From: Bas Gooren Date: Thu, 27 Feb 2020 10:39:23 +0100 Subject: [PATCH] Check if error response contains error message (Fixes #51) --- src/main/java/io/prismic/core/HttpClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/prismic/core/HttpClient.java b/src/main/java/io/prismic/core/HttpClient.java index 950afac..6a5efd0 100644 --- a/src/main/java/io/prismic/core/HttpClient.java +++ b/src/main/java/io/prismic/core/HttpClient.java @@ -60,7 +60,7 @@ public static JsonNode fetch(String url, Logger logger, Cache cache, Proxy proxy InputStream errorStream = httpConnection.getErrorStream(); if(errorStream != null) { JsonNode errorJson = new ObjectMapper().readTree(errorStream); - if (errorJson != null) { + if (errorJson != null && errorJson.get("error") != null) { errorText = errorJson.get("error").asText(); } }