Skip to content
This repository was archived by the owner on Jan 24, 2023. It is now read-only.

Commit 654fcb5

Browse files
committed
Check API response for failure
Fix #30
1 parent 27a2c33 commit 654fcb5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

content.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ async function getPrMetadataFromDocument() {
9090

9191
async function getPrMetadataFromApi(repo, prNumber) {
9292
const response = await fetch(`https://api.github.com/repos/${repo}/pulls/${prNumber}`);
93+
if (!response.ok) {
94+
return null;
95+
}
96+
9397
const prMetadata = await response.json();
9498
return {
9599
// These could be null in some cases, so replace nulls with empty strings.

0 commit comments

Comments
 (0)