Skip to content

Commit abb703b

Browse files
adding error handling to the RetryHandler
1 parent 2037ad3 commit abb703b

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

InjectionApi/Examples/ExampleCode/Basic/BasicComplexExample.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
use Socketlabs\Message\BasicMessage;
1010

1111
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
12-
//$client->proxyUrl = exampleConfig::proxy(); //Uncomment to configure a proxy such as fiddler
12+
// $client->proxyUrl = exampleConfig::proxy(); //Uncomment to configure a proxy
13+
// $client->exampleConfig::endpoint() //Uncomment to configure a different endpoint address
1314

1415
//Build the message
1516
$message = new BasicMessage();

InjectionApi/src/Core/RetryHandler.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ public function send(){
2323

2424
$context = stream_context_create($this->httpClient);
2525
$response = @file_get_contents($this->endpointUrl, FALSE, $context);
26-
return array($response, $http_response_header);
26+
27+
if (isset($http_response_header)) {
28+
return array($response, $http_response_header);
29+
}
30+
else {
31+
return array($response);
32+
}
2733

2834
}
2935

InjectionApi/src/SocketLabsClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SocketLabsClient{
1919
private $serverId;
2020
private $apiKey;
2121

22-
const VERSION = "1.4.4";
22+
const VERSION = "1.4.5";
2323
public $version = self::VERSION;
2424

2525
/**

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ For more information about AMP please see [AMP Project](https://amp.dev/document
199199

200200
<a name="version"></a>
201201
# Version
202+
* 1.4.5 - Adding error handling on RetryHandler
202203
* 1.4.4 - Removed Debugging Code
203204
* 1.4.3 - Added MetadataOrTagsAreTooLarge error messsage
204205
* 1.4.2 - Adding API Key Authorization

0 commit comments

Comments
 (0)