Skip to content

Commit b91ed46

Browse files
authored
Fix conditions for traversal source error output (#230)
Co-authored-by: Michael Chin <chnmch@amazon.com>
1 parent 0ebfa15 commit b91ed46

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/graph_notebook/neptune/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import json
77
import logging
8+
import re
89

910
import requests
1011
from SPARQLWrapper import SPARQLWrapper
@@ -190,7 +191,8 @@ def gremlin_query(self, query, bindings=None):
190191
return results
191192
except Exception as e:
192193
if isinstance(e, GremlinServerError):
193-
if e.status_code == 499:
194+
source_err = re.compile('The traversal source \\[.] for alias \\[.] is not configured on the server\\.')
195+
if e.status_code == 499 and source_err.search(str(e)):
194196
print("Error returned by the Gremlin Server for the traversal_source specified in notebook "
195197
"configuration. Please ensure that your graph database endpoint supports re-naming of "
196198
"GraphTraversalSource from the default of 'g' in Gremlin Server.")
@@ -207,7 +209,6 @@ def gremlin_http_query(self, query, headers=None) -> requests.Response:
207209
res = self._http_session.send(req)
208210
return res
209211

210-
211212
def gremlin_status(self, query_id: str = '', include_waiting: bool = False):
212213
kwargs = {}
213214
if include_waiting:

0 commit comments

Comments
 (0)