Repository: tinkerpop Updated Branches: refs/heads/master fd3c87d1d -> 1fabe15fb
TINKERPOP-1044: When using Gremlin-Server Client over REST endpoint and the gremlin query results in a groovy script Exception/Error, will output the Throwable class name as well as the Throwable Message in the message body of the HTTP Response Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/de9bbda5 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/de9bbda5 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/de9bbda5 Branch: refs/heads/master Commit: de9bbda5e44d5f4a8a7c024894027d1dccd6e2c5 Parents: 317fb0c Author: Vivek Krishnan <[email protected]> Authored: Tue Sep 27 23:21:42 2016 -0700 Committer: Vivek Krishnan <[email protected]> Committed: Tue Sep 27 23:21:42 2016 -0700 ---------------------------------------------------------------------- .../server/handler/HttpGremlinEndpointHandler.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/de9bbda5/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java ---------------------------------------------------------------------- diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index 7d2222f..a30c30e 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -253,8 +253,19 @@ public class HttpGremlinEndpointHandler extends ChannelInboundHandlerAdapter { })); evalFuture.exceptionally(t -> { - sendError(ctx, INTERNAL_SERVER_ERROR, - String.format("Error encountered evaluating script: %s", requestArguments.getValue0()), Optional.of(t)); + + if (t.getMessage() != null) { + sendError(ctx, INTERNAL_SERVER_ERROR, + String.format("Error encountered evaluating script: %s\nExecution Interrupted by %s\nMessage: %s", + requestArguments.getValue0(), t.getClass().getName(), t.getMessage()), + Optional.of(t)); + } else { + sendError(ctx, INTERNAL_SERVER_ERROR, + String.format("Error encountered evaluating script: %s\nExecution Interrupted by %s", + requestArguments.getValue0(), t.getClass().getName()), + Optional.of(t)); + } + promise.setFailure(t); return null; });
