fix: add failure reason for internal "new episode" response
This commit is contained in:
@@ -69,7 +69,10 @@ app.post(
|
||||
readEnvVariable(env<Env, typeof c>(c, "workerd"), "QSTASH_TOKEN"),
|
||||
c.req,
|
||||
);
|
||||
return c.json(ErrorResponse, { status: 500 });
|
||||
return c.json(
|
||||
{ success: false, message: "Failed to fetch episodes" },
|
||||
500,
|
||||
);
|
||||
}
|
||||
|
||||
const { episodes, providerId } = fetchEpisodesResult;
|
||||
@@ -81,7 +84,7 @@ app.post(
|
||||
readEnvVariable(env<Env, typeof c>(c, "workerd"), "QSTASH_TOKEN"),
|
||||
c.req,
|
||||
);
|
||||
return c.json(ErrorResponse, { status: 404 });
|
||||
return c.json({ success: false, message: "Episode not found" }, 404);
|
||||
}
|
||||
|
||||
let fetchUrlResult;
|
||||
@@ -98,7 +101,10 @@ app.post(
|
||||
readEnvVariable(env<Env, typeof c>(c, "workerd"), "QSTASH_TOKEN"),
|
||||
c.req,
|
||||
);
|
||||
return c.json(ErrorResponse, { status: 404 });
|
||||
return c.json(
|
||||
{ success: false, message: "Episode URL not found" },
|
||||
404,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Failed to fetch episode URL for episode ${episode.id}`);
|
||||
@@ -106,7 +112,10 @@ app.post(
|
||||
readEnvVariable(env<Env, typeof c>(c, "workerd"), "QSTASH_TOKEN"),
|
||||
c.req,
|
||||
);
|
||||
return c.json(ErrorResponse, { status: 500 });
|
||||
return c.json(
|
||||
{ success: false, message: "Failed to fetch episode URL" },
|
||||
500,
|
||||
);
|
||||
}
|
||||
|
||||
const tokens = await getTokensSubscribedToTitle(
|
||||
|
||||
Reference in New Issue
Block a user