Skip to content

Commit

Permalink
feat: Improve error handling in connection (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
exaby73 authored Nov 14, 2024
1 parent fe72acb commit 8a37c08
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Bolt/BoltConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Laudis\Neo4j\Contracts\FormatterInterface;
use Laudis\Neo4j\Databags\BookmarkHolder;
use Laudis\Neo4j\Databags\DatabaseInfo;
use Laudis\Neo4j\Databags\Neo4jError;
use Laudis\Neo4j\Enum\AccessMode;
use Laudis\Neo4j\Enum\ConnectionProtocol;
use Laudis\Neo4j\Exception\Neo4jException;
Expand Down Expand Up @@ -402,7 +403,11 @@ private function assertNoFailure(Response $response): void
{
if ($response->signature === Signature::FAILURE) {
$this->logger?->log(LogLevel::ERROR, 'FAILURE');
$this->protocol()->reset()->getResponse(); // what if the reset fails? what should be expected behaviour?
$resetResponse = $this->protocol()->reset()->getResponse();
$this->subscribedResults = [];
if ($resetResponse->signature === Signature::FAILURE) {
throw new Neo4jException([Neo4jError::fromBoltResponse($resetResponse), Neo4jError::fromBoltResponse($response)]);
}
throw Neo4jException::fromBoltResponse($response);
}
}
Expand Down

0 comments on commit 8a37c08

Please sign in to comment.