Skip to content

Commit 82d8246

Browse files
dodok8dahlia
andcommitted
refactor: change no handle error logic
Co-authored-by: Hong Minhee (洪 民憙) <[email protected]>
1 parent ac9b6bc commit 82d8246

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/botkit/src/pages.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ app.post("/follow", async (c) => {
443443

444444
try {
445445
if (!followerHandle) {
446-
throw new Error("No followerHandle!");
446+
return c.json({ error: "Follower handle is required." }, 400);
447447
}
448448

449449
if (followerHandle.startsWith("@")) {
@@ -473,10 +473,7 @@ app.post("/follow", async (c) => {
473473
return c.json({
474474
error: "No follow link found in WebFinger data.",
475475
}, 400);
476-
} catch (error) {
477-
if (error instanceof Error && error.message === "No followerHandle!") {
478-
return c.json({ error: "Follower handle is required." }, 400);
479-
}
476+
} catch (_error) {
480477
return c.json({ error: "An internal server error occurred." }, 500);
481478
}
482479
});

0 commit comments

Comments
 (0)