File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
src/components/models/code Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff 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 ` ;
You can’t perform that action at this time.
0 commit comments