From 7773c2741860ea09c9841f2ce8a371cc0f96f321 Mon Sep 17 00:00:00 2001 From: CultPodcastsBot <142722442+cultpodcasts@users.noreply.github.com> Date: Sun, 25 Aug 2024 10:47:53 +0100 Subject: [PATCH] Handle 404 (#42) --- src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index b299154..4563fdc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -587,8 +587,10 @@ app.get("/podcast/:name", auth0Middleware, async (c) => { }); if (resp.status == 200) { console.log(`Successfully used secure-podcast-endpoint.`); - return new Response(resp.body); + } else if (resp.status == 404) { + console.log(`Unable to find podcast.`); + return new Response(resp.body, { status: resp.status }); } else { console.log(`Failed to use secure-podcast-endpoint. Response code: '${resp.status}'.`); return c.json({ error: "Error" }, 500);