Skip to content

Commit

Permalink
TINKERPOP-2096 Throw GremlinServerError if server disconnects before …
Browse files Browse the repository at this point in the history
…read completes

Prior to this change we'd get a more obscure looking AttributeError which didn't really explain what had happened. CTR
  • Loading branch information
spmallette committed Dec 19, 2018
1 parent f9d7027 commit 79b5e1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Expand Up @@ -37,6 +37,7 @@ This release also includes changes from <<release-3-2-11, 3.2.11>>.
* Deprecated `TraversalSource#GREMLIN_REMOTE` and `TraversalSource#GREMLIN_REMOTE_CONNECTION_CLASS` moving them to `RemoteConnection`.
* Fixed the setting of the default label for a `ReferenceVertex` when the original vertex was of type `ComputerAdjacentVertex`.
* Changed Java driver to expect a generic `RemoteTraverser` object rather than the specific `DefaultRemoteTraverser`.
* Better handled server disconnect condition for the `gremlin-python` driver by throwing a clear exception.
* Display the remote stack trace in the Gremlin Console when scripts sent to the server fail.
* Added `AnonymousTraversalSource` which provides a more unified means of constructing a `TraversalSource`.
* Added `DriverRemoteConnection.using(Client)` to provide users better control over the number of connections being created.
Expand Down
Expand Up @@ -66,6 +66,10 @@ def write(self, request_id, request_message):
self._transport.write(message)

def data_received(self, message, results_dict):
# if Gremlin Server cuts off then we get a None for the message
if message is None:
raise GremlinServerError("Server disconnected - please try to reconnect")

message = self._message_serializer.deserialize_message(json.loads(message.decode('utf-8')))
request_id = message['requestId']
result_set = results_dict[request_id]
Expand Down

0 comments on commit 79b5e1c

Please sign in to comment.