Skip to content

Commit 8a37c08

Browse files
authored
feat: Improve error handling in connection (#239)
1 parent fe72acb commit 8a37c08

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Bolt/BoltConnection.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use Laudis\Neo4j\Contracts\FormatterInterface;
3131
use Laudis\Neo4j\Databags\BookmarkHolder;
3232
use Laudis\Neo4j\Databags\DatabaseInfo;
33+
use Laudis\Neo4j\Databags\Neo4jError;
3334
use Laudis\Neo4j\Enum\AccessMode;
3435
use Laudis\Neo4j\Enum\ConnectionProtocol;
3536
use Laudis\Neo4j\Exception\Neo4jException;
@@ -402,7 +403,11 @@ private function assertNoFailure(Response $response): void
402403
{
403404
if ($response->signature === Signature::FAILURE) {
404405
$this->logger?->log(LogLevel::ERROR, 'FAILURE');
405-
$this->protocol()->reset()->getResponse(); // what if the reset fails? what should be expected behaviour?
406+
$resetResponse = $this->protocol()->reset()->getResponse();
407+
$this->subscribedResults = [];
408+
if ($resetResponse->signature === Signature::FAILURE) {
409+
throw new Neo4jException([Neo4jError::fromBoltResponse($resetResponse), Neo4jError::fromBoltResponse($response)]);
410+
}
406411
throw Neo4jException::fromBoltResponse($response);
407412
}
408413
}

0 commit comments

Comments
 (0)