From a7572b4dfcb7782412541e377f6e743b0678f897 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 31 Mar 2024 09:38:54 -0600 Subject: [PATCH] fix: reaction error handling (#196) if an error occurs in `handleApprovedReaction` it gets thrown as unhandled, await it so it occurs within the catch block --- src/commands/signup/signup.consts.ts | 2 +- src/commands/signup/signup.service.ts | 2 +- src/sheets/sheets.service.ts | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/commands/signup/signup.consts.ts b/src/commands/signup/signup.consts.ts index 4fd3b365..8cfcbf96 100644 --- a/src/commands/signup/signup.consts.ts +++ b/src/commands/signup/signup.consts.ts @@ -24,7 +24,7 @@ You can reach out to a coordinator to discuss any issues PROG_SELECTION_TIMEOUT: 'Your response timed out and could not be recorded to set the prog point for this signup. The signup has not been added to the googlesheet since we could not determine what kind party it should be, please add it manually.', GENERIC_APPROVAL_ERROR: - 'An error occurred while processing your response. The signup may not have been added to the googlesheet, please verify it or add it manually', + 'An error occurred while processing your response. The signup may not have been added to the Google Sheet, please verify it or add it manually', }; export const SIGNUP_REVIEW_REACTIONS: Record< diff --git a/src/commands/signup/signup.service.ts b/src/commands/signup/signup.service.ts index 7fc7ca8b..26a0629c 100644 --- a/src/commands/signup/signup.service.ts +++ b/src/commands/signup/signup.service.ts @@ -100,7 +100,7 @@ class SignupService implements OnApplicationBootstrap, OnModuleDestroy { ); return shouldHandle - ? this.handleReaction(reaction, user, settings) + ? await this.handleReaction(reaction, user, settings) : EMPTY; } catch (error) { this.handleError(error, event.user, event.reaction.message); diff --git a/src/sheets/sheets.service.ts b/src/sheets/sheets.service.ts index 2fa63c7c..b79b45e6 100644 --- a/src/sheets/sheets.service.ts +++ b/src/sheets/sheets.service.ts @@ -283,7 +283,7 @@ class SheetsService { } } - const { encounter, character, world, role, progPoint = '' } = signup; + const { encounter, character, world } = signup; const range = ProgSheetRanges[encounter]; const values = await this.getSheetValues({ @@ -291,8 +291,6 @@ class SheetsService { range: `${sheetName}!${range.start}:${range.end}`, }); - this.logger.debug(`updating sheet: ${sheetName} with range ${range}`); - const row = this.findCharacterRow( values, (values) =>