fix: show meaningful error messages in dashboard
Replace hardcoded "Failed to fetch usage" in the Dashboard tab with the ErrorMessage component so errors like TOKEN_EXPIRED, HTTP 429, and network failures display human-readable text consistent with the detail tabs. Also improve HTTP error copy and add network-level error detection. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+3
-12
@@ -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" && (
|
||||
<View className="flex-row items-center gap-x-2 py-1">
|
||||
<MaterialIcons name="error-outline" size={16} color="#ef4444" />
|
||||
<Text className="text-sm text-red-500 dark:text-red-400">
|
||||
Failed to fetch usage
|
||||
</Text>
|
||||
</View>
|
||||
<ErrorMessage message={codex.error} />
|
||||
)}
|
||||
{codex.usage && (
|
||||
<View>
|
||||
@@ -271,12 +267,7 @@ function DashboardTabContent() {
|
||||
/>
|
||||
)}
|
||||
{claude.auth && claude.status === "error" && (
|
||||
<View className="flex-row items-center gap-x-2 py-1">
|
||||
<MaterialIcons name="error-outline" size={16} color="#ef4444" />
|
||||
<Text className="text-sm text-red-500 dark:text-red-400">
|
||||
Failed to fetch usage
|
||||
</Text>
|
||||
</View>
|
||||
<ErrorMessage message={claude.error} />
|
||||
)}
|
||||
{claude.usage && (
|
||||
<View>
|
||||
|
||||
Reference in New Issue
Block a user