Ensure appropriate error status code is set

This commit is contained in:
Maciej Pędzich 2023-01-07 23:46:33 +01:00
parent ce61d32b24
commit 05e28ddbc1

View File

@ -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;
}
---