Skip to content

Commit 7c8f622

Browse files
committed
Handle test message errors
1 parent b17dfc9 commit 7c8f622

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/utils/WebManager.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,12 @@ export default class WebManager {
9999

100100
async testMessage(req: Req<{ user: string }>, res: Res): Promise<void> {
101101
const userid = req.params.user
102-
const user = await client.users.fetch(userid)
103-
await user.send("This is a test")
104-
res.sendStatus(200)
102+
try {
103+
const user = await client.users.fetch(userid)
104+
await user.send("This is a test message")
105+
res.sendStatus(200)
106+
} catch (error) {
107+
res.status(400).send("Could not message")
108+
}
105109
}
106110
}

0 commit comments

Comments
 (0)