fix: Add fallback if episode is missing
Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
This commit is contained in:
parent
992057b6f7
commit
8586a208f9
|
|
@ -15,6 +15,15 @@ export const handler = async (_req: Request, ctx: FreshContext): Promise<Respons
|
|||
|
||||
console.log("going to get ep for ", episodeId);
|
||||
const episode = await nrkRadio.getEpisode(seriesId, episodeId);
|
||||
|
||||
if (!episode) {
|
||||
return new Response(JSON.stringify({ message: `Episode ${episodeId} is missing` }), {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
status: 500,
|
||||
});
|
||||
}
|
||||
const chapters = toChapters(episode);
|
||||
const body = {
|
||||
version: "1.2.0",
|
||||
|
|
|
|||
Loading…
Reference in New Issue