Better logging
This commit is contained in:
@ -137,7 +137,11 @@ class Subscription extends AbstractEndPoint
|
||||
$statement = $this->ventaService->getRepository()->getConnection()->execute($query, $values);
|
||||
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $exception) {
|
||||
$this->logger->error($exception);
|
||||
$this->logger->error($exception->getMessage(), [
|
||||
'query' => $query,
|
||||
'values' => $values,
|
||||
'ids' => $idsData,
|
||||
'exception' => $exception]);
|
||||
throw new EmptyResult($query, $exception);
|
||||
}
|
||||
|
||||
@ -162,11 +166,34 @@ class Subscription extends AbstractEndPoint
|
||||
];
|
||||
try {
|
||||
if (!$this->edit($tokuId, $data, array_key_exists($idx, $keys) ? $keys[$idx] : null)) {
|
||||
$this->logger->error("Error while updating Toku {$tokuId}");
|
||||
$this->logger->error('Error while updating Toku', [
|
||||
'toku_id' => $tokuId,
|
||||
'old_pid' => $oldPids[$idx],
|
||||
'product_id' => $newPids[$idx],
|
||||
'account_key' => array_key_exists($idx, $keys) ? $keys[$idx] : null]);
|
||||
$output[] = [
|
||||
'toku_id' => $tokuId,
|
||||
'old_pid' => $oldPids[$idx],
|
||||
'product_id' => $newPids[$idx],
|
||||
'account_key' => array_key_exists($idx, $keys) ? $keys[$idx] : null,
|
||||
'error' => 'Error while updating Toku'
|
||||
];
|
||||
continue;
|
||||
}
|
||||
} catch (EmptyResponse $exception) {
|
||||
$this->logger->error($exception);
|
||||
$this->logger->error($exception->getMessage(), [
|
||||
'toku_id' => $tokuId,
|
||||
'old_pid' => $oldPids[$idx],
|
||||
'product_id' => $newPids[$idx],
|
||||
'account_key' => array_key_exists($idx, $keys) ? $keys[$idx] : null,
|
||||
'exception' => $exception]);
|
||||
$output[] = [
|
||||
'toku_id' => $tokuId,
|
||||
'old_pid' => $oldPids[$idx],
|
||||
'product_id' => $newPids[$idx],
|
||||
'account_key' => array_key_exists($idx, $keys) ? $keys[$idx] : null,
|
||||
'error' => $exception->getMessage()
|
||||
];
|
||||
continue;
|
||||
}
|
||||
$output[] = [
|
||||
@ -262,7 +289,10 @@ class Subscription extends AbstractEndPoint
|
||||
$statement = $this->ventaService->getRepository()->getConnection()->execute($query, $values);
|
||||
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $exception) {
|
||||
$this->logger->error($exception);
|
||||
$this->logger->error($exception->getMessage(), [
|
||||
'query' => $query,
|
||||
'values' => $values,
|
||||
'exception' => $exception]);
|
||||
throw new EmptyResult($query, $exception);
|
||||
}
|
||||
$keys = array_column($results, 'account_key');
|
||||
|
Reference in New Issue
Block a user