Skip to content

Commit

Permalink
refactor: remove inappropriate throw IIFE
Browse files Browse the repository at this point in the history
  • Loading branch information
yuimarudev committed Nov 30, 2024
1 parent e0ede5d commit 735f94d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/synthesizer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export default class Synthesizer {
});

if (!res.ok) throw new Error("読み上げに失敗しました");
if (!res.body)
throw new Error("読み上げに失敗しました(body が帰ってきていません)");

return res.body;
}
Expand Down
9 changes: 1 addition & 8 deletions src/voice/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,7 @@ export default class Room {

const resource = new AudioResource(
[],
[
Readable.fromWeb(
(await synthesizer.synthesis(content)) ||
(() => {
throw "stream not found!";
})(),
),
],
[Readable.fromWeb(await synthesizer.synthesis(content))],
{},
5,
);
Expand Down

0 comments on commit 735f94d

Please sign in to comment.