fix(ui): show specific Bible passage error messages#203
fix(ui): show specific Bible passage error messages#203davidfedor wants to merge 3 commits intomainfrom
Conversation
Map BibleTextView errors to clearer user-facing messages for missing passages, missing or invalid app keys, forbidden access, rate limits, unreachable server/timeouts, and 5xx responses. Extract the error-message mapping into a dedicated UI helper and extend component tests to cover the new cases.
|
Greptile SummaryThis PR extracts Bible text error handling into a dedicated Key changes:
One minor open point:
Confidence Score: 5/5Safe to merge — all previously flagged issues are resolved and the only remaining finding is a minor defensive hardening suggestion. Both P1 issues from prior review rounds (5xx/not-found ordering and offline test isolation) are fully addressed. The single new comment is P2: the message.includes('not found') fallback could theoretically misclassify a non-HTTP JS error, but it will never cause data loss or a crash. All happy and error paths are covered by tests. packages/ui/src/lib/bible-text-error.ts — the message.includes('not found') arm on line 47 could be tightened to only apply when status is undefined. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[BibleTextView receives error] --> B{error.status?}
B -->|401| C[INVALID_APP_KEY_MESSAGE]
B -->|403| D[FORBIDDEN_MESSAGE]
B -->|429| E[RATE_LIMITED_MESSAGE]
B -->|>= 500| F[SERVER_ERROR_MESSAGE]
B -->|404| G[PASSAGE_NOT_FOUND_MESSAGE]
B -->|undefined / other| H{message includes 'not found'?}
H -->|yes| G
H -->|no| I{navigator.onLine === false?}
I -->|yes| J[UNREACHABLE_SERVER_MESSAGE]
I -->|no| K{isUnreachableServerError message match?}
K -->|yes| J
K -->|no| L[GENERIC_ERROR_MESSAGE]
Reviews (3): Last reviewed commit: "Merge branch 'main' into df/error-msgs" | Re-trigger Greptile |
|
@greptile are all your concerns addressed satisfactorily? |
|
Yes, both concerns are addressed: P1 (5xx shadowing): Fixed by checking P2 (offline test isolation): Fixed by using |
|
@cameronapak I'd love your thoughts on this. Is there a different way you'd suggest that this be structured? Feel free to completely rewrite this if I'm not approaching it the right way. |
cameronapak
left a comment
There was a problem hiding this comment.
This looks good to me. Thank you for making it where we have better, more specific error copy! Can you run pnpm changeset at the project's root to bump all of the packages, so that the changes propogate into the next version? (we bump them all at once for them to stay on the same version across the board for react sdk packages)
Map BibleTextView errors to clearer user-facing messages for missing passages, missing or invalid app keys, forbidden access, rate limits, unreachable server/timeouts, and 5xx responses.
Extract the error-message mapping into a dedicated UI helper and extend component tests to cover the new cases.