File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 66
77use Psr \Log \LoggerInterface ;
88use SimPod \PhpSnmp \Exception \GeneralException ;
9+ use SimPod \PhpSnmp \Exception \TimeoutReached ;
910
1011final class FallbackSnmpClient implements SnmpClient
1112{
@@ -76,7 +77,7 @@ private function tryClients(callable $requestCallback) : array
7677 foreach ($ this ->snmpClients as $ key => $ snmpClient ) {
7778 try {
7879 return $ requestCallback ($ snmpClient );
79- } catch (GeneralException $ exception ) {
80+ } catch (GeneralException | TimeoutReached $ exception ) {
8081 $ this ->logger ->warning (
8182 'SNMP request failed ' ,
8283 [
Original file line number Diff line number Diff line change 88use Psr \Log \NullLogger ;
99use Psr \Log \Test \TestLogger ;
1010use SimPod \PhpSnmp \Exception \GeneralException ;
11+ use SimPod \PhpSnmp \Exception \TimeoutReached ;
1112use SimPod \PhpSnmp \Transport \FallbackSnmpClient ;
1213use SimPod \PhpSnmp \Transport \Request ;
1314use SimPod \PhpSnmp \Transport \SnmpClient ;
@@ -82,7 +83,7 @@ public function testOnlyLastClientWorks() : void
8283 $ client1 ->expects (self ::once ())
8384 ->method ('get ' )
8485 ->with ($ oids = ['.1.2.3 ' ])
85- ->willThrowException ($ exception1 = GeneralException:: new ( ' an error ' ));
86+ ->willThrowException ($ exception1 = TimeoutReached:: fromOid ( ' 127.0.0.1 ' , ' .1.2.3 ' ));
8687
8788 $ client2 = $ this ->createMock (SnmpClient::class);
8889 $ client2 ->expects (self ::once ())
You can’t perform that action at this time.
0 commit comments