Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/code/Magento/Ups/Model/Carrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -1200,10 +1200,10 @@ function () use ($httpResponse, $debugData) {
$debugData['result'] = ['error' => $e->getMessage(), 'code' => $e->getCode()];
$this->_logger->critical($e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also refactor this logger, as it logs really messy context in the log. Instead, I'd go:

$this->_logger->critical('UPS Exception: ' . $e->getMessage(), [
    'trace' => $e->getTrace(),
    'payload' => $ratePayload
]);

That gives you enough information for debugging and the usage of 2nd argument (array $context) gives you the context of an event.

}
if ($responseResult) {
$jsonResponse = $responseResult->getStatusCode() >= 400 ? '' : $responseResult->getBody();
if ($responseResult && ($responseResult->getStatusCode() < 400)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not need additional parenthesis.

Suggested change
if ($responseResult && ($responseResult->getStatusCode() < 400)) {
if ($responseResult && $responseResult->getStatusCode() < 400) {

$jsonResponse = $responseResult->getBody();
$debugData['result'] = $jsonResponse;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it's HTTP 401 / 503 etc. - Your solution does not give any debug information.

}
$debugData['result'] = $jsonResponse;
$this->_debug($debugData);

return $this->_parseRestResponse($jsonResponse);
Expand Down