mirror of
https://github.com/maciejpedzich/spotifyplaylistarchive.com.git
synced 2024-11-09 23:13:01 +01:00
Ensure appropriate error status code is set
This commit is contained in:
parent
ce61d32b24
commit
05e28ddbc1
@ -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;
|
||||
}
|
||||
---
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user