Skip to content

Commit

Permalink
fix: reaction error handling (#196)
Browse files Browse the repository at this point in the history
if an error occurs in `handleApprovedReaction` it gets thrown as
unhandled, await it so it occurs within the catch block
  • Loading branch information
ssilve1989 authored Mar 31, 2024
1 parent 01b9be6 commit a7572b4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/commands/signup/signup.consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down
2 changes: 1 addition & 1 deletion src/commands/signup/signup.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions src/sheets/sheets.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,14 @@ class SheetsService {
}
}

const { encounter, character, world, role, progPoint = '' } = signup;
const { encounter, character, world } = signup;
const range = ProgSheetRanges[encounter];

const values = await this.getSheetValues({
spreadsheetId,
range: `${sheetName}!${range.start}:${range.end}`,
});

this.logger.debug(`updating sheet: ${sheetName} with range ${range}`);

const row = this.findCharacterRow(
values,
(values) =>
Expand Down

0 comments on commit a7572b4

Please sign in to comment.