This repository was archived by the owner on Jun 10, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +23
-16
lines changed Expand file tree Collapse file tree 4 files changed +23
-16
lines changed Original file line number Diff line number Diff line change @@ -231,9 +231,7 @@ protected function syncMeta(): void
231231 return ;
232232 }
233233
234- throw new Exception (
235- sprintf ('It was not possible to establish a connection for metadata with the brokers "%s" ' , $ brokerList )
236- );
234+ throw Exception \ConnectionException::fromBrokerList ($ brokerList );
237235 }
238236
239237 protected function getGroupBrokerId (): void
Original file line number Diff line number Diff line change 1+ <?php
2+ declare (strict_types=1 );
3+
4+ namespace Kafka \Exception ;
5+
6+ use Kafka \Exception ;
7+ use function sprintf ;
8+
9+ final class ConnectionException extends Exception
10+ {
11+ public static function fromBrokerList (string $ brokerList ): self
12+ {
13+ return new self (
14+ sprintf (
15+ 'It was not possible to establish a connection for metadata with the brokers "%s" ' ,
16+ $ brokerList
17+ )
18+ );
19+ }
20+ }
Original file line number Diff line number Diff line change @@ -167,12 +167,7 @@ public function syncMeta(): void
167167 }
168168 }
169169
170- throw new Exception (
171- sprintf (
172- 'It was not possible to establish a connection for metadata with the brokers "%s" ' ,
173- $ brokerList
174- )
175- );
170+ throw Exception \ConnectionException::fromBrokerList ($ brokerList );
176171 }
177172
178173 /**
Original file line number Diff line number Diff line change 1414use function explode ;
1515use function json_encode ;
1616use function shuffle ;
17- use function sprintf ;
1817use function substr ;
1918use function trim ;
2019
@@ -144,12 +143,7 @@ public function syncMeta(): void
144143 return ;
145144 }
146145
147- throw new Exception (
148- sprintf (
149- 'It was not possible to establish a connection for metadata with the brokers "%s" ' ,
150- $ brokerList
151- )
152- );
146+ throw Exception \ConnectionException::fromBrokerList ($ brokerList );
153147 }
154148
155149 /**
You can’t perform that action at this time.
0 commit comments