|
@@ -80,6 +80,7 @@ class Webservice
|
|
|
$results = json_decode($this->makeGetRequest($url), true);
|
|
|
} catch (\Exception $ex) {
|
|
|
var_dump($ex->getMessage());
|
|
|
+ $this->log($ex->getMessage(), 'error');
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -108,6 +109,7 @@ class Webservice
|
|
|
$response = $response->getContent();
|
|
|
} catch (RequestException $ex) {
|
|
|
$response = '';
|
|
|
+ $this->log($ex->getMessage(), 'error');
|
|
|
}
|
|
|
|
|
|
return $response;
|
|
@@ -142,6 +144,7 @@ class Webservice
|
|
|
$this->httpClient->send($request, $response);
|
|
|
$response = $response->getContent();
|
|
|
} catch (RequestException $ex) {
|
|
|
+ $this->log($ex->getMessage(), 'error');
|
|
|
throw $ex;
|
|
|
}
|
|
|
|
|
@@ -166,7 +169,7 @@ class Webservice
|
|
|
$url = $this->buildUrl($url, $filters, false, $order_by, $limit, $offset);
|
|
|
$data = json_decode($this->makeGetRequest($url), true);
|
|
|
} catch (\Exception $ex) {
|
|
|
- // TODO : Loguear esta exception o lanzarla.
|
|
|
+ $this->log($ex->getMessage(), 'error');
|
|
|
}
|
|
|
|
|
|
return $data;
|
|
@@ -190,6 +193,7 @@ class Webservice
|
|
|
$url = $this->buildUrl($url, $filters, false, $order_by, $limit, $offset);
|
|
|
$data = json_decode($this->makeRequest($url), true);
|
|
|
} catch (\Exception $ex) {
|
|
|
+ $this->log($ex->getMessage(), 'error');
|
|
|
}
|
|
|
|
|
|
return $data;
|
|
@@ -275,6 +279,8 @@ class Webservice
|
|
|
try {
|
|
|
$return = curl_exec($ch);
|
|
|
} catch (\Exception $ex) {
|
|
|
+ $this->log($ex->getMessage(), 'error');
|
|
|
+
|
|
|
return array("error" => "Connection Error.");
|
|
|
}
|
|
|
|
|
@@ -294,6 +300,7 @@ class Webservice
|
|
|
if (!is_null($id)) {
|
|
|
$url = str_replace(".json", "/{$id}", $url);
|
|
|
}
|
|
|
+
|
|
|
return $url . $extra;
|
|
|
|
|
|
}
|
|
@@ -343,7 +350,8 @@ class Webservice
|
|
|
* @param $alias
|
|
|
* @param $field
|
|
|
* @param $value
|
|
|
- * @return bool
|
|
|
+ *
|
|
|
+ * @return bool
|
|
|
*/
|
|
|
public function getClientFilter($queryBuilder, $alias, $field, $value)
|
|
|
{
|
|
@@ -382,6 +390,20 @@ class Webservice
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
return $resp;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param $message
|
|
|
+ * @param $level
|
|
|
+ * @param $monologLoggerId
|
|
|
+ */
|
|
|
+ public function log($message, $level = 'info', $monologLoggerId = 'monolog.logger.webservice')
|
|
|
+ {
|
|
|
+ if ($this->serviceContainer->has($monologLoggerId)) {
|
|
|
+ $this->serviceContainer->get($monologLoggerId)->$level($message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|