From f557de7a287c679fe32b2e8547db00a17db2a6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathis=20Dr=C3=B6ge?= Date: Fri, 15 Dec 2023 13:17:58 +0100 Subject: [PATCH] QuoteCommand: Wrap pull request creation in a try-catch The plugin will actually throw `Error`s for a lot of failure states, which weren't caught before --- src/commands/quoteCommand.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/commands/quoteCommand.ts b/src/commands/quoteCommand.ts index bba28e88..15d64167 100644 --- a/src/commands/quoteCommand.ts +++ b/src/commands/quoteCommand.ts @@ -100,11 +100,16 @@ export class QuoteCommand extends Command { }); const commandIssuerNick = await this.getAuthorNick(guild, interaction.user); - const pullRequestNumber = await githubAPI.openFortunesPullRequest( - fortunes, - commandIssuerNick, - nickname - ); + let pullRequestNumber; + try { + pullRequestNumber = await githubAPI.openFortunesPullRequest( + fortunes, + commandIssuerNick, + nickname + ); + } catch (e) { + console.trace(e); + } if (pullRequestNumber == undefined) { const sadcaret = await getSadCaret(interaction);