15
15
* Client for easy usage of Recombee recommendation API
16
16
*/
17
17
class Client{
18
-
18
+
19
19
protected $ account ;
20
20
protected $ token ;
21
21
protected $ request ;
@@ -72,7 +72,7 @@ protected function getUserAgent() {
72
72
* @throws Exceptions\ApiTimeoutException ApiTimeoutException if the request takes too long
73
73
*/
74
74
public function send (Requests \Request $ request ) {
75
-
75
+
76
76
if ($ request instanceof Requests \Batch && count ($ request ->requests ) > Client::BATCH_MAX_SIZE )
77
77
return $ this ->sendMultipartBatch ($ request );
78
78
@@ -108,12 +108,12 @@ public function send(Requests\Request $request) {
108
108
}
109
109
catch (\GuzzleHttp \Exception \ConnectException $ e )
110
110
{
111
- throw new ApiTimeoutException ($ request );
111
+ throw new ApiTimeoutException ($ request, $ e );
112
112
}
113
113
catch (\GuzzleHttp \Exception \GuzzleException $ e )
114
114
{
115
- if (strpos ($ e ->getMessage (), 'cURL error 28 ' ) !== false ) throw new ApiTimeoutException ($ request );
116
- if (strpos ($ e ->getMessage (), 'timed out ' ) !== false ) throw new ApiTimeoutException ($ request );
115
+ if (strpos ($ e ->getMessage (), 'cURL error 28 ' ) !== false ) throw new ApiTimeoutException ($ request, $ e );
116
+ if (strpos ($ e ->getMessage (), 'timed out ' ) !== false ) throw new ApiTimeoutException ($ request, $ e );
117
117
118
118
throw $ e ;
119
119
}
@@ -129,7 +129,7 @@ protected function getOptionalHttpHeaders() {
129
129
}
130
130
131
131
protected function getHttpHeaders () {
132
- return array_merge (array ('User-Agent ' => $ this ->user_agent ), $ this ->getOptionalHttpHeaders ());
132
+ return array_merge (array ('User-Agent ' => $ this ->user_agent ), $ this ->getOptionalHttpHeaders ());
133
133
}
134
134
135
135
protected function getRequestOptions () {
0 commit comments