diff --git a/src/components/LatestDocsVersion b/src/components/LatestDocsVersion index c667f7a2..d9313317 100644 --- a/src/components/LatestDocsVersion +++ b/src/components/LatestDocsVersion @@ -12,18 +12,23 @@ const LatestDocsVersion = () => { 'X-GitHub-Api-Version': '2022-11-28', }, }) - .then(response => response.json()) - .then(data => { - setVersion(data.tag_name); - }) - .catch(error => { - console.error('Error fetching version:', error); - setVersion('Failed to load version'); - }); + .then(response => { + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + return response.json(); + }) + .then(data => { + setVersion(data.tag_name); + }) + .catch(error => { + console.error('Error fetching version:', error); + setVersion('Failed to load version'); + }); }, []); return ( - version || "N/A" + {version} // Wrapped in a span for potential styling or semantic purposes ); };