Added fallback for code 530

This commit is contained in:
Jonas_Jones 2023-12-13 04:06:54 +01:00
parent f138451053
commit b17bd1c406

View file

@ -33,6 +33,12 @@ addEventListener('fetch', event => {
status: 420, status: 420,
statusText: 'API Backend Downtime Error' statusText: 'API Backend Downtime Error'
}); });
} else if (apiResponse.status === 530) {
// If the API request fails, return an error response
return new Response('API backend went down just now :( It should be back up in a matter of seconds!', {
status: 421,
statusText: 'API Backend Downtime Error'
});
} else { } else {
// If the API request fails, return the API response // If the API request fails, return the API response
return apiResponse; return apiResponse;