From 4654037123a9ff3d082df36fabec8ac52bb8c36d Mon Sep 17 00:00:00 2001 From: Kieran Klukas <92754843+kcoderhtml@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:08:37 -0500 Subject: [PATCH] feat: if user not found then return dummy pfp --- src/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 1377caf..dcd073a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -264,8 +264,16 @@ const app = new Elysia() try { slackUser = await slackApp.getUserInfo(params.user); } catch (e) { - if (e instanceof Error && e.message === "user_not_found") - return error(404, { message: "User not found" }); + if (e instanceof Error && e.message === "user_not_found") { + console.warn( + `\x1b[38;5;214m ⚠️ WARN\x1b[0m user not found: \x1b[38;5;208m${params.user}\x1b[0m`, + ); + + return redirect( + "https://api.dicebear.com/9.x/thumbs/svg?seed={username_hash}", + 307, + ); + } Sentry.withScope((scope) => { scope.setExtra("url", request.url); -- 2.51.2