From 190d7f7d266f5d4cf91814407a07a70e0b72a915 Mon Sep 17 00:00:00 2001 From: alexbcberio Date: Wed, 5 Jan 2022 19:40:28 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A5=20Remove=20try/catch=20from=20time?= =?UTF-8?q?out?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Call to this method should now be surrounded by try catch --- src/backend/chatClient/clientActions/timeout/index.ts | 6 +----- src/backend/chatClient/index.ts | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backend/chatClient/clientActions/timeout/index.ts b/src/backend/chatClient/clientActions/timeout/index.ts index 3d145bc..da76ea4 100644 --- a/src/backend/chatClient/clientActions/timeout/index.ts +++ b/src/backend/chatClient/clientActions/timeout/index.ts @@ -15,11 +15,7 @@ async function timeout( reason = ""; } - try { - await chatClient.timeout(channel, username, time, reason); - } catch (e) { - // user cannot be timed out - } + await chatClient.timeout(channel, username, time, reason); } export { timeout }; diff --git a/src/backend/chatClient/index.ts b/src/backend/chatClient/index.ts index f3e016f..ecfd68f 100644 --- a/src/backend/chatClient/index.ts +++ b/src/backend/chatClient/index.ts @@ -57,7 +57,11 @@ async function handleClientAction(action: Action): Promise { say(channel, action.data.message); break; case ActionType.Timeout: - await timeout(channel, username, action.data.time, action.data.reason); + try { + await timeout(channel, username, action.data.time, action.data.reason); + } catch (e) { + // user cannot be timed out + } break; case ActionType.Broadcast: broadcast(action.data.message);