Skip to content

Commit a79a236

Browse files
kodster28KianNH
andauthored
Apply suggestions from code review
Co-authored-by: Kian <[email protected]>
1 parent bff19d2 commit a79a236

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/models/code/WhisperBase64Code.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121
async fetch(request, env, ctx): Promise<Response> {
2222
const mp3 = await fetch(URL);
2323
if (!mp3.ok) {
24-
throw new Error(\`Response status: \${mp3.status}\`);
24+
return Response.json({ error: \`Failed to fetch MP3: \${mp3.status}\` });
2525
}
2626
const mp3Buffer = await mp3.arrayBuffer();
2727
const base64 = Buffer.from(mp3Buffer, 'binary').toString("base64");
@@ -32,9 +32,9 @@ export default {
3232
return Response.json(res);
3333
}
3434
catch (e) {
35-
console.log(JSON.stringify(env.AI));
35+
console.error(e);
36+
return Response.json({ error: "An unexpected error occurred" });
3637
}
37-
return new Response(JSON.stringify({ho:"to"}));
3838
},
3939
} satisfies ExportedHandler<Env>
4040
`;

0 commit comments

Comments
 (0)