Skip to content

Commit f557de7

Browse files
CommandMCbgianfo
authored andcommitted
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
1 parent 20a48a6 commit f557de7

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/commands/quoteCommand.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,16 @@ export class QuoteCommand extends Command {
100100
});
101101

102102
const commandIssuerNick = await this.getAuthorNick(guild, interaction.user);
103-
const pullRequestNumber = await githubAPI.openFortunesPullRequest(
104-
fortunes,
105-
commandIssuerNick,
106-
nickname
107-
);
103+
let pullRequestNumber;
104+
try {
105+
pullRequestNumber = await githubAPI.openFortunesPullRequest(
106+
fortunes,
107+
commandIssuerNick,
108+
nickname
109+
);
110+
} catch (e) {
111+
console.trace(e);
112+
}
108113

109114
if (pullRequestNumber == undefined) {
110115
const sadcaret = await getSadCaret(interaction);

0 commit comments

Comments
 (0)