diff --git a/src/VIPSoft/CodeCoverageExtension/Driver/RemoteXdebug.php b/src/VIPSoft/CodeCoverageExtension/Driver/RemoteXdebug.php index 0d008f2..0b4f05e 100644 --- a/src/VIPSoft/CodeCoverageExtension/Driver/RemoteXdebug.php +++ b/src/VIPSoft/CodeCoverageExtension/Driver/RemoteXdebug.php @@ -68,11 +68,14 @@ public function __construct(array $config, Client $client) public function start() { $request = $this->buildRequest('create'); - - $response = $request->send(); - - if ($response->getStatusCode() !== 200) { - throw new \Exception('remote driver start failed: ' . $response->getReasonPhrase()); + try { + $response = $request->send(); + + if ($response->getStatusCode() !== 200) { + throw new \Exception('remote driver start failed: ' . $response->getReasonPhrase()); + } + } catch (\Exception $ex) { + print 'Remote failed due to:' . $ex->getMessage() . "\n"; } } @@ -83,17 +86,21 @@ public function stop() { $request = $this->buildRequest('read'); $request->setHeader('Accept', 'application/json'); + try { + $response = $request->send(); - $response = $request->send(); + if ($response->getStatusCode() !== 200) { + throw new \Exception('remote driver fetch failed: ' . $response->getReasonPhrase()); + } - if ($response->getStatusCode() !== 200) { - throw new \Exception('remote driver fetch failed: ' . $response->getReasonPhrase()); - } + $request = $this->buildRequest('delete'); + $request->send(); - $request = $this->buildRequest('delete'); - $request->send(); - - return json_decode($response->getBody(true), true); + return json_decode($response->getBody(true), true); + } catch (\Exception $ex) { + print 'Remote failed due to:' . $ex->getMessage() . "\n"; + return array(); + } } /**