You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/04/06 22:10:55 UTC

tinkerpop git commit: TINKERPOP-1044 Added documentation for additional error info in ResponseMessage

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1044 b29bab0ac -> c33069cec


TINKERPOP-1044 Added documentation for additional error info in ResponseMessage


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c33069ce
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c33069ce
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c33069ce

Branch: refs/heads/TINKERPOP-1044
Commit: c33069cecd227dff664a02330a8462efce32e121
Parents: b29bab0
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 6 18:10:08 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 6 18:10:08 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  2 ++
 .../upgrade/release-3.2.x-incubating.asciidoc   | 35 ++++++++++++++++++++
 .../driver/exception/ResponseException.java     |  7 ++++
 3 files changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c33069ce/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 19d1d59..00ada7e 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -31,6 +31,8 @@ TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 * `ProfileStrategy` now uses the marker-model to reduce recursive lookups of `ProfileSideEffectStep`.
 * `Mutating` steps now implement `Scoping` interface.
 * Fixed a step id compilation bug in `AddVertexStartStep`, `AddVertexStep`, `AddEdgeStep`, and `AddPropertyStep`.
+* Added more details to Gremlin Server client side messages - exception hierarchy and stack trace.
+* Deprecated "Exception-Class" in the Gremlin Server HTTP protocol in favor of the new "exceptions" field.
 * De-registered metrics on Gremlin Server shutdown.
 * Added "help" command option on `:remote config` for plugins that support that feature in the Gremlin Console.
 * Allowed for multiple scripts and related arguments to be passed to `gremlin.sh` via `-i` and `-e`.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c33069ce/docs/src/upgrade/release-3.2.x-incubating.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index fbe31bd..4324578 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -42,6 +42,41 @@ set. Note that metrics are captured for both sessionless requests as well as for
 
 See: https://issues.apache.org/jira/browse/TINKERPOP-1644[TINKERPOP-1644]
 
+Additional Error Information
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Additional information on error responses from Gremlin Server should help make debugging errors easier. Error responses
+now have both the exception hierarchy and the stack trace that was generated on the server. In this way, receiving an
+error on a client doesn't mean having to rifle through Gremlin Server logs to try to find the associated error.
+
+This change has been applied to all Gremlin Server protocols. For the binary protocol and the Java driver this change
+means that the `ResponseException` thrown from calls to `submit()` requests to the server now have the following
+methods:
+
+[source,java]
+----
+public Optional<String> getRemoteStackTrace()
+
+public Optional<List<String>> getRemoteExceptionHierarchy()
+----
+
+The HTTP protocol has also been updated and returns both `exceptions` and `stackTrace` fields in the response:
+
+[source,js]
+----
+{
+	"message": "Division by zero",
+	"Exception-Class": "java.lang.ArithmeticException",
+	"exceptions": ["java.lang.ArithmeticException"],
+	"stackTrace": "java.lang.ArithmeticException: Division by zero\n\tat java.math.BigDecimal.divide(BigDecimal.java:1742)\n\tat org.codehaus.groovy.runtime.typehandling.BigDecimalMath.divideImpl(BigDecimalMath.java:68)\n\tat org.codehaus.groovy.runtime.typehandling.IntegerMath.divideImpl(IntegerMath.java:49)\n\tat org.codehaus.groovy.runtime.dgmimpl.NumberNumberDiv$NumberNumber.invoke(NumberNumberDiv.java:323)\n\tat org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)\n\tat org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)\n\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)\n\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)\n\tat Script4.run(Script4.groovy:1)\n\tat org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:834)\n\tat org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovy
 ScriptEngine.eval(GremlinGroovyScriptEngine.java:547)\n\tat javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)\n\tat org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines.eval(ScriptEngines.java:120)\n\tat org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$2(GremlinExecutor.java:314)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n\tat java.lang.Thread.run(Thread.java:745)\n"
+}
+----
+
+Note that the `Exception-Class` which was added in a previous version has been deprecated and replaced by these new
+fields.
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1044[TINKERPOP-1044]
+
 Gremlin Console Scripting
 ^^^^^^^^^^^^^^^^^^^^^^^^^
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c33069ce/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/exception/ResponseException.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/exception/ResponseException.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/exception/ResponseException.java
index 800c2fc..51e748a 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/exception/ResponseException.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/exception/ResponseException.java
@@ -47,10 +47,17 @@ public class ResponseException extends Exception {
         return responseStatusCode;
     }
 
+    /**
+     * The stacktrace produced by the remote server.
+     */
     public Optional<String> getRemoteStackTrace() {
         return Optional.ofNullable(remoteStackTrace);
     }
 
+    /**
+     * The list of exceptions generated by the server starting with the top-most one followed by its "cause". That
+     * cause is then followed by its cause and so on down the line.
+     */
     public Optional<List<String>> getRemoteExceptionHierarchy() {
         return Optional.ofNullable(remoteExceptionHierarchy);
     }