Skip to content

Commit c6104b1

Browse files
exaby73transistive
authored andcommitted
feat: Check for 5.2 and 5.1 on generic ConnectException
1 parent 3158357 commit c6104b1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Bolt/ProtocolFactory.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
use Bolt\Bolt;
1717
use Bolt\connection\IConnection;
18-
use Bolt\error\BoltException;
1918
use Bolt\error\ConnectException;
2019
use Bolt\protocol\V4_4;
2120
use Bolt\protocol\V5;
@@ -38,11 +37,10 @@ public function createProtocol(IConnection $connection, AuthenticateInterface $a
3837

3938
try {
4039
$protocol = $bolt->build();
41-
} catch (BoltException $e) {
42-
if ($e instanceof ConnectException && $e->getMessage() === 'Wrong version') {
43-
$bolt->setProtocolVersions(5.2, 5.1);
44-
$protocol = $bolt->build();
45-
}
40+
} catch (ConnectException $e) {
41+
// Assume incorrect protocol version
42+
$bolt->setProtocolVersions(5.2, 5.1);
43+
$protocol = $bolt->build();
4644
}
4745

4846
if (!($protocol instanceof V4_4 || $protocol instanceof V5 || $protocol instanceof V5_1 || $protocol instanceof V5_2 || $protocol instanceof V5_3 || $protocol instanceof V5_4)) {

0 commit comments

Comments
 (0)