/** * Executes a Query or read command * * @param CommandInterface|BaseBuilder $query * @return Response * @throws \Exception * @throws \brightzone\rexpro\ServerException */ public function executeReadCommand($query) { if ($query instanceof BaseBuilder) { throw new NotSupportedException("There are currently no processors for gremlin/cypher."); } elseif (!$this->isSupportedLanguage($query->getScriptLanguage())) { throw new NotSupportedException(__CLASS__ . " does not support " . $query->getScriptLanguage()); } try { $response = $this->client->send($query->getScript()); } catch (\Exception $e) { //Check for empty return error from server. if ($e instanceof \brightzone\rexpro\ServerException && $e->getCode() == 204) { $response = []; } else { throw $e; } } return new Response(['_raw' => $response, '_driver' => $this]); }