Skip to content

Commit

Permalink
[DX-648]- added fallback in case of version is not fetched
Browse files Browse the repository at this point in the history
  • Loading branch information
naman-contentstack committed Nov 21, 2024
1 parent 8df65ca commit 937c6ef
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ export default async function (_opts): Promise<void> {

if (now - cache.lastChecked > versionUpgradeWarningFrequencyConfig.versionSyncDuration) {
try {
const latestVersion = (await httpClient.get(`https://registry.npmjs.org/@contentstack/cli/latest`)).data.version;
const latestVersion = (await httpClient.get(`https://registry.npmjs.org/@contentstack/cli/latest`))?.data
?.version;
if (!latestVersion) {
logger.error('Failed to retrieve the latest version from the registry.');
return;
}
cache.latestVersion = latestVersion;
cache.lastChecked = now;

Expand Down

0 comments on commit 937c6ef

Please sign in to comment.