in hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/service/query/GremlinQueryService.java [182:212]
private ResultSet executeGremlin(String gremlin, HugeClient client) {
try {
return client.gremlin().gremlin(gremlin).execute();
} catch (ServerException e) {
String exception = e.exception();
log.error("Gremlin execute failed: {}", exception);
if (ILLEGAL_GREMLIN_EXCEPTIONS.contains(exception)) {
throw new IllegalGremlinException("gremlin.illegal-statemnt", e,
e.message());
}
throw new ExternalException("gremlin.execute.failed", e, e.message());
} catch (ClientException e) {
Throwable cause = e.getCause();
if (cause != null) {
String message = cause.getMessage();
if (message != null && message.startsWith(TIMEOUT_EXCEPTION)) {
throw new InternalException("gremlin.execute.timeout", e,
message);
}
if (message != null && message.contains(CONN_REFUSED_MSG)) {
throw new InternalException("gremlin.connection.refused", e,
message);
}
}
throw e;
} catch (Exception e) {
log.error("Gremlin execute failed", e);
throw new ExternalException("gremlin.execute.failed", e,
e.getMessage());
}
}