Skip to content

Commit

Permalink
Merge pull request #2148 from GSA/1491-site-wide-banner-js
Browse files Browse the repository at this point in the history
fixing handling 404
  • Loading branch information
kkrug authored Feb 12, 2025
2 parents ea5c448 + 092d6ab commit a236564
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@
document.addEventListener('DOMContentLoaded', () => {
fetch(endpoint)
.then(response => {
if (!response.ok) {
if (response.status === 404) {
throw new Error('404 Not Found');
}
throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.text();
})
.then(data => {
Expand All @@ -146,7 +152,11 @@
}
})
.catch(error => {
console.error('Error fetching data from challenge platform:');
if (error.message.includes('404')) {
console.log('Response is 404');
} else {
console.error('Error:', error);
}
});
});
</script>
Expand Down

0 comments on commit a236564

Please sign in to comment.