From 05e28ddbc1dc52a21950b6d3002013137d94d991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20P=C4=99dzich?= Date: Sat, 7 Jan 2023 23:46:33 +0100 Subject: [PATCH] Ensure appropriate error status code is set --- src/layouts/PlaylistPageSection.astro | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/layouts/PlaylistPageSection.astro b/src/layouts/PlaylistPageSection.astro index 446f708..c8aeadd 100644 --- a/src/layouts/PlaylistPageSection.astro +++ b/src/layouts/PlaylistPageSection.astro @@ -22,6 +22,9 @@ try { ? "This playlist doesn't exist" : "Failed to fetch playlist's data"; + Astro.response.status = githubResponse.status; + Astro.response.statusText = errorMessage; + throw new Error(errorMessage); } @@ -38,13 +41,14 @@ try { "Failed to fetch playlist's data", "This playlist doesn't exist" ]; + const [miscError] = expectedErrorMessages displayTitle = 'Error'; playlistFetchError = (error as Error).message; description = expectedErrorMessages.includes(playlistFetchError) ? playlistFetchError - : expectedErrorMessages[0]; + : miscError; } ---