public function testHasNoResponse()
 {
     $req = new Request('GET', '/');
     $prev = new \Exception();
     $e = new ConnectException('foo', $req, $prev, ['foo' => 'bar']);
     $this->assertSame($req, $e->getRequest());
     $this->assertNull($e->getResponse());
     $this->assertFalse($e->hasResponse());
     $this->assertEquals('foo', $e->getMessage());
     $this->assertEquals('bar', $e->getHandlerContext()['foo']);
     $this->assertSame($prev, $e->getPrevious());
 }
예제 #2
0
파일: Client.php 프로젝트: crate/crate-pdo
 /**
  * @param ConnectException $exception
  */
 private function raiseIfNoMoreServers($exception)
 {
     if (count($this->availableServers) == 0) {
         throw new ConnectException("No more servers available, exception from last server: " . $exception->getMessage(), $exception->getRequest());
     }
 }
 public static function create(\GuzzleHttp\Exception\ConnectException $e)
 {
     $message = sprintf('Connection error %s on %s', $e->getMessage(), $e->getRequest()->getUri());
     return new self($message, 0, $e);
 }