fix: improve error handling for GitLab API rate limit exceeded
This commit is contained in:
16
index.ts
16
index.ts
@ -378,9 +378,19 @@ async function handleGitLabError(
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const errorBody = await response.text();
|
const errorBody = await response.text();
|
||||||
throw new Error(
|
// Check specifically for Rate Limit error
|
||||||
`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`
|
if (response.status === 403 && errorBody.includes("User API Key Rate limit exceeded")) {
|
||||||
);
|
console.error("GitLab API Rate Limit Exceeded:", errorBody);
|
||||||
|
console.log("User API Key Rate limit exceeded. Please try again later.");
|
||||||
|
throw new Error(
|
||||||
|
`GitLab API Rate Limit Exceeded: ${errorBody}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Handle other API errors
|
||||||
|
throw new Error(
|
||||||
|
`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user