fix: improve error UX with actionable messages and pre-flight AI check#21
Merged
fix: improve error UX with actionable messages and pre-flight AI check#21
Conversation
Apply Nielsen/NNGroup usability heuristics to error handling: Heuristic #5 — Error Prevention: - Pre-flight checkHealth() before rendering the Generate button - Disable button and show Drupal messenger warning when no AI provider is configured, preventing the error entirely Heuristic #9 — Help Users Recognize, Diagnose, and Recover: - Unify all 6 AJAX error handlers to use buildUserFriendlyErrorMessage() (previously only 2 of 6 used it — the rest showed raw exceptions) - Tighten pattern matching: match specific error strings like "no chat provider" instead of broad substrings like "provider" - Add patterns for CRUD errors ("card not found", "idea not found") - Plain language: "No AI service connected" not "Chat provider is not properly configured" - Every message includes a concrete next step (link or action) - Shorter generic fallback that links to error log Heuristic #1 — Visibility of System Status: - Use Drupal messenger API for the pre-flight warning so it renders through the theme's message pipeline Also fix phpcbf exit code handling: exit 2 ("nothing to fix") is success, not failure. Closes #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Applies Nielsen/NNGroup usability heuristics to error handling in the GUI.
checkHealth()check disables the Generate button and shows a Drupal messenger warning when no AI provider is configured — users no longer have to click, wait, and discover it won't workbuildUserFriendlyErrorMessage()(previously only 2 of 6 did). Tightened pattern matching, plain-language messages, every error includes a concrete next step$this->messenger()->addWarning()so it renders through the theme's standard message pipelineAlso fixes phpcbf exit code handling in the auto-fix script (exit 2 = "nothing to fix" is success, not failure).
Test plan
/admin/reports/ai/content-strategywith no AI provider configured — warning message appears, Generate button is disabledCloses #20