diff --git a/client/src/main/java/client/utils/ServerUtils.java b/client/src/main/java/client/utils/ServerUtils.java index 408ae11..37ebd30 100644 --- a/client/src/main/java/client/utils/ServerUtils.java +++ b/client/src/main/java/client/utils/ServerUtils.java @@ -41,7 +41,7 @@ public class ServerUtils { HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); if(response.statusCode() != statusOK){ - throw new IOException("No recipe to get. Server responds with " + response.statusCode()); + throw new IOException("No recipe to get. Server responds with " + response.body()); } @@ -62,7 +62,7 @@ public class ServerUtils { HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); if(response.statusCode() != statusOK){ - throw new IOException("failed finding recipe with id: "+ id + " body: " + response.statusCode()); + throw new IOException("failed finding recipe with id: "+ id + " body: " + response.body()); } return objectMapper.readValue(response.body(),Recipe.class); @@ -96,7 +96,7 @@ public class ServerUtils { HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); if(response.statusCode() != statusOK){ - throw new IOException("Failed to add Recipe: " + newRecipe.getId() + "body: " + response.statusCode()); + throw new IOException("Failed to add Recipe: " + newRecipe.toDetailedString() + "body: " + response.body()); } return objectMapper.readValue(response.body(),Recipe.class); @@ -114,7 +114,7 @@ public class ServerUtils { HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); if(response.statusCode() != statusOK){ - throw new IOException("Failed removing recipe with id: " + id + "body: " + response.statusCode()); + throw new IOException("Failed removing recipe with id: " + id + "body: " + response.body()); } } @@ -133,7 +133,7 @@ public class ServerUtils { //200 is the status code for success, other codes can mean there is no recipe to clone if(response.statusCode() != statusOK){ - throw new IOException("Failed to get recipe to clone with id: " + id + "body: " + response.statusCode()); + throw new IOException("Failed to get recipe to clone with id: " + id + "body: " + response.body()); } // recipe exists so you can make a "new" recipe aka the clone Recipe recipe = objectMapper.readValue(response.body(), Recipe.class);