diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-22 12:09:52 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-22 12:09:52 +1000 |
commit | 94a2d57e9093cbe753774e0fffad8ef2dbc51896 (patch) | |
tree | a9065c2fa65f33191bd784085b8012ed5ced5227 | |
parent | Do measurements one at a time in order (diff) | |
download | server-94a2d57e9093cbe753774e0fffad8ef2dbc51896.tar.xz |
Try catch handleFile
-rw-r--r-- | slowcord/login/src/index.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/slowcord/login/src/index.ts b/slowcord/login/src/index.ts index 68234e83..a17e9eaa 100644 --- a/slowcord/login/src/index.ts +++ b/slowcord/login/src/index.ts @@ -31,7 +31,7 @@ const toDataURL = async (url: string) => { const blob = await response.blob(); const buffer = Buffer.from(await blob.text()); return `data:${blob.type};base64,${buffer.toString("base64")}`; -} +}; class Discord { static getAccessToken = async (req: Request, res: Response) => { @@ -126,9 +126,14 @@ app.get("/oauth/:type", async (req, res) => { }); if (details.avatar_url) { - const avatar = await handleFile(`/avatars/${user.id}`, await toDataURL(details.avatar_url) as string); - user.avatar = avatar; - await user.save(); + try { + const avatar = await handleFile(`/avatars/${user.id}`, await toDataURL(details.avatar_url) as string); + user.avatar = avatar; + await user.save(); + } + catch (e) { + console.error(e); + } } } |