diff --git a/src/main/java/seedu/us/among/logic/request/EndpointCaller.java b/src/main/java/seedu/us/among/logic/request/EndpointCaller.java index a31ee68dde1..e42cea4866e 100644 --- a/src/main/java/seedu/us/among/logic/request/EndpointCaller.java +++ b/src/main/java/seedu/us/among/logic/request/EndpointCaller.java @@ -81,7 +81,7 @@ public Response callEndpoint() throws RequestException, AbortRequestException { } else { throw new AbortRequestException(MESSAGE_CONNECTION_ERROR); } - } catch (IOException e) { + } catch (Exception e) { logger.warning(StringUtil.getDetails(e)); throw new RequestException(MESSAGE_GENERAL_ERROR); } finally { diff --git a/src/main/java/seedu/us/among/logic/request/Request.java b/src/main/java/seedu/us/among/logic/request/Request.java index bf2e213d69b..6658689d9f7 100644 --- a/src/main/java/seedu/us/among/logic/request/Request.java +++ b/src/main/java/seedu/us/among/logic/request/Request.java @@ -106,7 +106,8 @@ private String formatEntity(HttpEntity entity) throws IOException { String responseEntity = ""; if (entity != null) { responseEntity = EntityUtils.toString(entity); - if (entity.getContentType().getValue().toLowerCase().contains("application/json")) { + if (entity.getContentType() != null + && entity.getContentType().getValue().toLowerCase().contains("application/json")) { responseEntity = JsonUtil.toPrettyPrintJsonString(responseEntity); } }