Skip to content

Commit

Permalink
Expanded ternary operator on Line 260 into if then else
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivek Krishnan committed Sep 28, 2016
1 parent 3202db1 commit f364a37
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,12 @@ public void channelRead(final ChannelHandlerContext ctx, final Object msg) {
}
}));

evalFuture.exceptionally(t -> {

String errorMessage = (t.getMessage() != null) ? t.getMessage() :
String.format("Error encountered evaluating script: %s", requestArguments.getValue0());
sendError(ctx, INTERNAL_SERVER_ERROR, errorMessage, Optional.of(t));
evalFuture.exceptionally(t -> {
if (t.getMessage() != null)
sendError(ctx, INTERNAL_SERVER_ERROR, t.getMessage(), Optional.of(t));
else
sendError(ctx, INTERNAL_SERVER_ERROR, String.format("Error encountered evaluating script: %s", requestArguments.getValue0())
, Optional.of(t));
promise.setFailure(t);
return null;
});
Expand Down Expand Up @@ -460,7 +461,6 @@ private static void sendError(final ChannelHandlerContext ctx, final HttpRespons
node.put("Exception-Class", t.get().getClass().getName());
}


final FullHttpResponse response = new DefaultFullHttpResponse(
HTTP_1_1, status, Unpooled.copiedBuffer(node.toString(), CharsetUtil.UTF_8));
response.headers().set(CONTENT_TYPE, "application/json");
Expand Down

0 comments on commit f364a37

Please sign in to comment.