Skip to content

Commit

Permalink
Merge pull request #141 from JeffreytheCoder/wrong-pr-number
Browse files Browse the repository at this point in the history
Add error message for wrong PR number
  • Loading branch information
samad-yar-khan authored Mar 25, 2024
2 parents 24bea46 + 6731caa commit a7267b4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions github/modals/pullDetailsModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,31 @@ export async function pullDetailsModal({
const pullRawData = await http.get(
`https://api.github.com/repos/${data?.repository}/pulls/${data?.number}`
);

// If pullsNumber doesn't exist, notify the user
if (pullRawData.statusCode === 404) {
block.addSectionBlock({
text: {
text: `Pull request #${data?.number} doesn't exist.`,
type: TextObjectType.PLAINTEXT,
},
});

return {
title: {
type: TextObjectType.PLAINTEXT,
text: AppEnum.DEFAULT_TITLE,
},
close: block.newButtonElement({
text: {
type: TextObjectType.PLAINTEXT,
text: "Close",
},
}),
blocks: block.getBlocks(),
};
}

const pullData = pullRawData.data;

const pullRequestFilesRaw = await http.get(
Expand Down

0 comments on commit a7267b4

Please sign in to comment.