Skip to content

Commit 835d9c9

Browse files
authored
Handle github rate limiting response (#24573)
Make the error messages clearer when the API doesn't respond with 200.
1 parent 7698758 commit 835d9c9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/release/shared-commands/get-build-id-for-commit.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ async function getBuildIdForCommit(sha) {
2323
);
2424

2525
if (!statusesResponse.ok) {
26-
throw Error('Could not find commit for: ' + sha);
26+
if (statusesResponse.status === 404) {
27+
throw Error('Could not find commit for: ' + sha);
28+
}
29+
const {message, documentation_url} = await statusesResponse.json();
30+
const msg = documentation_url
31+
? `${message}\n\t${documentation_url}`
32+
: message;
33+
throw Error(msg);
2734
}
2835

2936
const {statuses, state} = await statusesResponse.json();

0 commit comments

Comments
 (0)