From bf196cf81f3706b2251968523f41d8c423b4e18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20P=C4=99dzich?= Date: Sun, 22 Jan 2023 20:44:20 +0100 Subject: [PATCH] Enforce consistent API error handling --- src/utils/getPlaylistLayoutProps.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/getPlaylistLayoutProps.ts b/src/utils/getPlaylistLayoutProps.ts index f578894..be2e5a1 100644 --- a/src/utils/getPlaylistLayoutProps.ts +++ b/src/utils/getPlaylistLayoutProps.ts @@ -17,7 +17,7 @@ export async function getPlaylistLayoutProps(Astro: Readonly) { ); if (!githubResponse.ok) { - throw new Error(githubResponse.status.toString()); + throw new Error(`GitHub ${githubResponse.status}`); } playlist = (await githubResponse.json()) as PlaylistSnapshot; @@ -28,7 +28,7 @@ export async function getPlaylistLayoutProps(Astro: Readonly) { ? `${playlist.unique_name} (${playlist.original_name})` : playlist.original_name; } catch (error) { - const isNotFoundError = (error as Error).message === '404'; + const isNotFoundError = (error as Error).message === 'GitHub 404'; errorOccurred = true; title = 'Error';