Skip to content

Fix #3023: Improve error message for invalid Font Awesome icons#3037

Open
cobyfrombrooklyn-bot wants to merge 1 commit intorust-lang:masterfrom
cobyfrombrooklyn-bot:fix-issue-3023
Open

Fix #3023: Improve error message for invalid Font Awesome icons#3037
cobyfrombrooklyn-bot wants to merge 1 commit intorust-lang:masterfrom
cobyfrombrooklyn-bot:fix-issue-3023

Conversation

@cobyfrombrooklyn-bot
Copy link

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:

Caused by: Missing font github

This leaves users confused about what went wrong and how to fix it, especially since fa-github was suggested by older documentation.

Fix

Improved the error message in the fa_helper handlebars helper to include:

  • The icon name that was looked up
  • The icon type that was searched (brands/regular/solid)
  • The valid prefix options (fas, fab, far)
  • A link to the FontAwesome v6 free icon gallery

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

Test

Added fontawesome_error_message integration test that:

  • Configures git-repository-icon = "fa-github" (a common mistake — should be fab-github)
  • Verifies the build fails with the improved error message
  • Uses [..] wildcards for line/col numbers so the test is stable across template changes

Full test suite passes on macOS ARM (Apple Silicon): 251 passed, 0 failed.

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
@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: waiting on a review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants