Skip to content

fix: improve error handling UI for Gaps and Try It screens#14

Merged
jvsena42 merged 1 commit into
mainfrom
fix/error-handling-ui
Mar 29, 2026
Merged

fix: improve error handling UI for Gaps and Try It screens#14
jvsena42 merged 1 commit into
mainfrom
fix/error-handling-ui

Conversation

@jvsena42
Copy link
Copy Markdown
Owner

Summary

Fix error handling for the Gaps and Try It screens when the Claude API key is invalid or there is a request error. Previously, the Gaps screen showed a loading spinner forever on API failure, and both screens displayed raw/technical error messages (e.g., JSON parse errors). Now, ClaudeApiClient checks HTTP status codes and returns user-friendly messages, the Gaps screen displays a proper error state with retry, and the Try It screen's inline error was upgraded to a styled error content with retry button.

Changes

  • Add HTTP status code checking in ClaudeApiClient.sendRequest() — maps 401, 429, 5xx to user-friendly error messages and catches network exceptions
  • Add ClaudeErrorResponse / ClaudeErrorDetail models to ClaudeApiModels.kt
  • Add ErrorContent composable to Android GapsScreen with error icon, message, and retry button
  • Add errorContent(message:) view to iOS GapsScreen.swift with matching design
  • Replace simple ErrorMessage with styled ErrorContent (icon + message + retry) on Android TryItScreen
  • Replace simple errorMessage() with styled errorContent(message:) on iOS TryItScreen.swift
  • Add common_retry string resource to all 4 locale files (en/pt-BR for Android and iOS)

Test plan

  • Set an invalid API key in Settings, navigate to Gaps screen → should show error with "Invalid API key" message and Retry button
  • Tap Retry → should reload and show the same error (or succeed if key was corrected)
  • Set an invalid API key, navigate to Try It screen, take a photo, tap Analyze → should show styled error content with Retry button
  • Tap Retry → should re-attempt analysis
  • Verify both screens on Android and iOS

Checklist

  • ./gradlew detekt passes
  • Tested on Android
  • Tested on iOS
  • Updated documentation (if applicable)

@jvsena42 jvsena42 enabled auto-merge March 29, 2026 18:07
@jvsena42 jvsena42 merged commit cad3aee into main Mar 29, 2026
1 check passed
@jvsena42 jvsena42 deleted the fix/error-handling-ui branch March 29, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant