Open History to see the last commit
1/** Diff failures currently include transport wrappers, so recognize the reason inside them. */
2export function describePullRequestDiffError(error: string, providerName: string, term: string) {
3 if (/\brate limit\b|\brate[-_]limited\b|\btoo many requests\b/i.test(error)) {
4 return {
5 title: `${providerName} rate limit reached`,
6 description: `${providerName} is temporarily limiting requests, so this diff couldn't be loaded. Try again after the limit resets, or view the changes on ${providerName}.`,
7 };
8 }
9
10 return {
11 title: "Couldn't load the changes",
12 description: `The environment couldn't load this ${term}'s diff. Try again, or view the changes on ${providerName}.`,
13 };
14}