Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ TinkerPop 3.2.3 (Release Date: NOT OFFICIALLY RELEASED YET)
* VertexPrograms can now declare traverser requirements, e.g. to have access to the path when used with `.program()`.
* New build options for `gremlin-python` where `-DglvPython` is no longer required.
* Added missing `InetAddress` to GraphSON extension module.
* Added functionality to Gremlin-Server REST endpoint to forward Exception Messages and Class in HTTP Response

[[release-3-2-2]]
TinkerPop 3.2.2 (Release Date: September 6, 2016)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,12 @@ public void channelRead(final ChannelHandlerContext ctx, final Object msg) {
}
}));

evalFuture.exceptionally(t -> {
sendError(ctx, INTERNAL_SERVER_ERROR,
String.format("Error encountered evaluating script: %s", requestArguments.getValue0()), 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 @@ -454,6 +457,10 @@ private static void sendError(final ChannelHandlerContext ctx, final HttpRespons
errorMeter.mark();
final ObjectNode node = mapper.createObjectNode();
node.put("message", message);
if (t.isPresent()){
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