Skip to content

Commit

Permalink
Fix: fix a bug where null exception results in looping gif
Browse files Browse the repository at this point in the history
  • Loading branch information
tjtanjin committed Mar 30, 2021
1 parent a803882 commit 2ddf6f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/seedu/us/among/logic/request/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 2ddf6f4

Please sign in to comment.