Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions src/VIPSoft/CodeCoverageExtension/Driver/RemoteXdebug.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}

Expand All @@ -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();
}
}

/**
Expand Down