From b17bd1c4062c0e0d51d6dee0c50e11cb460c98ca Mon Sep 17 00:00:00 2001 From: Jonas_Jones <91549607+J-onasJones@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:06:54 +0100 Subject: [PATCH] Added fallback for code 530 --- src/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.js b/src/index.js index 994097f..c033d03 100644 --- a/src/index.js +++ b/src/index.js @@ -33,6 +33,12 @@ addEventListener('fetch', event => { status: 420, 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 { // If the API request fails, return the API response return apiResponse;