@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 35 lines 1.16 KB
Raw
1 import { msg } from "gt-react";
2
3 import { m, type MessageResolver } from "~/i18n/messages";
4
5 import type { ChangeRequestTermKind } from "./changeRequestTerm";
6
7 /** Diff failures currently include transport wrappers, so recognize the reason inside them. */
8 export function describePullRequestDiffError(
9 error: string,
10 providerName: string,
11 term: ChangeRequestTermKind,
12 resolve: MessageResolver = m,
13 ) {
14 if (/\brate limit\b|\brate[-_]limited\b|\btoo many requests\b/i.test(error)) {
15 return {
16 title: resolve(msg("{providerName} rate limit reached", { providerName })),
17 description: resolve(
18 msg(
19 "{providerName} is temporarily limiting requests, so this diff couldn't be loaded. Try again after the limit resets, or view the changes on {providerName}.",
20 { providerName },
21 ),
22 ),
23 };
24 }
25
26 return {
27 title: resolve(msg("Couldn't load the changes")),
28 description: resolve(
29 msg(
30 "The environment couldn't load this {term, select, mr {merge request} cr {change request} other {pull request}}'s diff. Try again, or view the changes on {providerName}.",
31 { term, providerName },
32 ),
33 ),
34 };
35 }