feat: improve InvalidIndexFile error to mention index file names#1859
Merged
mre merged 4 commits intolycheeverse:masterfrom Sep 30, 2025
Merged
feat: improve InvalidIndexFile error to mention index file names#1859mre merged 4 commits intolycheeverse:masterfrom
mre merged 4 commits intolycheeverse:masterfrom
Conversation
this makes it clearer which files are causing the link check to fail. it also lets us customise the message in the special case of `--index-files ''`, which could otherwise be confusing with a generic message. the messages are: ``` [ERROR] file:///h | Cannot find index file within directory: An index file (index.html) is required [ERROR] file:///h | Cannot find index file within directory: An index file (index.html, or index.htm) is required [ERROR] file:///h | Cannot find index file within directory: An index file (index.html, index.htm, or index.md) is required ``` and for the `--index-files ''` case: ``` [ERROR] file:///h | Cannot find index file within directory: No directory links are allowed because index_files is defined and empty ``` i do wonder if this last error message is still confusing because of the "Cannot find index file within directory" text. maybe it should be changed to a more general "Cannot resolve link to local directory"? for comparison, the old message was always: ``` [ERROR] file:///h | Cannot find index file within directory: Index file not found in directory. Check if index.html or other index files exist ```
c9749ac to
94b2aea
Compare
mre
reviewed
Sep 30, 2025
| ErrorKind::InvalidIndexFile(index_files) => match &index_files[..] { | ||
| [] => "No directory links are allowed because index_files is defined and empty".to_string(), | ||
| [name] => format!("An index file ({name}) is required"), | ||
| [init @ .., tail] => format!("An index file ({}, or {}) is required", init.join(", "), tail), |
Member
There was a problem hiding this comment.
I had no clue you could do init @ ..
Member
|
Definitely much clearer. I don't really have a strong opinion on your |
Closed
This was referenced Oct 21, 2025
Closed
Merged
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.
this makes it clearer which files are causing the link check to fail. it also lets us customise the message in the special case of
--index-files '', which could otherwise be confusing with a generic message.the messages are:
and for the
--index-files ''case:i do wonder if this last error message is still confusing because of the "Cannot find index file within directory" text. maybe it should be changed to a more general "Cannot resolve link to local directory" or "Invalid local directory link"?
for comparison, the old message was this:
and it was constant and never changed.