1515 * Client for easy usage of Recombee recommendation API
1616*/
1717class Client{
18-
18+
1919 protected $ account ;
2020 protected $ token ;
2121 protected $ request ;
@@ -72,7 +72,7 @@ protected function getUserAgent() {
7272 * @throws Exceptions\ApiTimeoutException ApiTimeoutException if the request takes too long
7373 */
7474 public function send (Requests \Request $ request ) {
75-
75+
7676 if ($ request instanceof Requests \Batch && count ($ request ->requests ) > Client::BATCH_MAX_SIZE )
7777 return $ this ->sendMultipartBatch ($ request );
7878
@@ -108,12 +108,12 @@ public function send(Requests\Request $request) {
108108 }
109109 catch (\GuzzleHttp \Exception \ConnectException $ e )
110110 {
111- throw new ApiTimeoutException ($ request );
111+ throw new ApiTimeoutException ($ request, $ e );
112112 }
113113 catch (\GuzzleHttp \Exception \GuzzleException $ e )
114114 {
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 );
117117
118118 throw $ e ;
119119 }
@@ -129,7 +129,7 @@ protected function getOptionalHttpHeaders() {
129129 }
130130
131131 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 ());
133133 }
134134
135135 protected function getRequestOptions () {
0 commit comments