diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx
index 3db092b..c4b682b 100644
--- a/app/(tabs)/index.tsx
+++ b/app/(tabs)/index.tsx
@@ -16,6 +16,7 @@ import { onUsageDataLoaded } from "@/lib/notifications";
import { ProgressBar } from "@/components/ProgressBar";
import { ResetCountdown } from "@/components/ResetCountdown";
import { LastUpdated } from "@/components/LastUpdated";
+import { ErrorMessage } from "@/components/ErrorMessage";
import { ScreenErrorBoundary } from "@/components/ScreenErrorBoundary";
import { COLORS, getUsageColor } from "@/lib/constants";
import { windowLabel } from "@/lib/timeUtils";
@@ -184,12 +185,7 @@ function DashboardTabContent() {
/>
)}
{codex.auth && codex.status === "error" && (
-
-
-
- Failed to fetch usage
-
-
+
)}
{codex.usage && (
@@ -271,12 +267,7 @@ function DashboardTabContent() {
/>
)}
{claude.auth && claude.status === "error" && (
-
-
-
- Failed to fetch usage
-
-
+
)}
{claude.usage && (
diff --git a/components/ErrorMessage.tsx b/components/ErrorMessage.tsx
index 94d3564..867a2af 100644
--- a/components/ErrorMessage.tsx
+++ b/components/ErrorMessage.tsx
@@ -11,11 +11,23 @@ const ERROR_MESSAGES: Record = {
"Claude returned an unexpected usage response. The app was kept safe from invalid data.",
INVALID_CLAUDE_ORGS_RESPONSE:
"Claude returned an unexpected organizations response.",
+ UNKNOWN_ERROR: "An unknown error occurred. Try refreshing.",
};
function humanize(code: string): string {
if (code.startsWith("HTTP_ERROR_")) {
- return `Unexpected server error (HTTP ${code.replace("HTTP_ERROR_", "")}).`;
+ const status = code.replace("HTTP_ERROR_", "");
+ if (status === "429") return "Rate limited by the server. Try again shortly.";
+ if (status === "500" || status === "502" || status === "503")
+ return `Server error (${status}). The service may be down.`;
+ return `Unexpected server response (HTTP ${status}).`;
+ }
+ if (
+ code === "Network request failed" ||
+ code.includes("fetch") ||
+ code.includes("network")
+ ) {
+ return "Network error. Check your internet connection and try again.";
}
return ERROR_MESSAGES[code] ?? `Unexpected error: ${code}`;
}