Fix #3023: Improve error message for invalid Font Awesome icons#3037
Open
cobyfrombrooklyn-bot wants to merge 1 commit intorust-lang:masterfrom
Open
Fix #3023: Improve error message for invalid Font Awesome icons#3037cobyfrombrooklyn-bot wants to merge 1 commit intorust-lang:masterfrom
cobyfrombrooklyn-bot wants to merge 1 commit intorust-lang:masterfrom
Conversation
When an invalid Font Awesome icon name is used (e.g. in git-repository-icon),
the error message now includes the icon name, the type that was searched,
valid prefix options (fas/fab/far), and a link to the FontAwesome icon gallery.
Before: Missing font github
After: Unknown Font Awesome icon `github` for type `regular`. Hint: check
the icon name and prefix (fas (solid), fab (brands), or far (regular))
at https://fontawesome.com/v6/search?m=free
Fixes rust-lang#3023
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.
Problem
When an invalid Font Awesome icon name is used in
book.toml(e.g.git-repository-icon = "fa-github"), the error message is cryptic:This leaves users confused about what went wrong and how to fix it, especially since
fa-githubwas suggested by older documentation.Fix
Improved the error message in the
fa_helperhandlebars helper to include:After:
Test
Added
fontawesome_error_messageintegration test that:git-repository-icon = "fa-github"(a common mistake — should befab-github)[..]wildcards for line/col numbers so the test is stable across template changesFull test suite passes on macOS ARM (Apple Silicon): 251 passed, 0 failed.