Skip to content

Commit

Permalink
add more detail to error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
artyom-jaksov-tl committed Oct 25, 2024
1 parent 57f2d26 commit 68d9a89
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Block/Adminhtml/System/Config/Button/VersionCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ public function getLatestVersion()
$this->curl->get('https://api.github.com/repos/TrueLayer/magento2/releases');
$responseStatus = $this->curl->getStatus();
if ($responseStatus !== 200) {
$this->logger->error('Cron failed', [
$this->logger->error('Plugin version check failed, could not retrieve releases from github api', [
'response_status' => $responseStatus,
'response_body' => $this->curl->getBody()
]);
return false;
}
}
$response = $this->curl->getBody();
try {
$releases = json_decode($response, true, JSON_THROW_ON_ERROR);
} catch (\Exception $e) {
$this->logger->error('Cannot decode response', [
$this->logger->error('Plugin version check failed, json_decode error', [
'response_body' => $response,
'json_exception' => $e->getMessage()
]);
Expand All @@ -100,7 +100,7 @@ public function getLatestVersion()
}
}
if (!isset($latestRelease)) {
$this->logger->error('Could not find latest release');
$this->logger->error('Plugin version check failed, no valid release in github api response');
return false;
}
$latestVersion = ltrim($latestRelease['name'], 'v');
Expand Down

0 comments on commit 68d9a89

Please sign in to comment.