25: Name the sub-plugin a rejected config is about - #39
Open
nikolaystrikhar wants to merge 1 commit into
Open
Conversation
Every Config_Exception from the constructor named the offending key and nothing else. Registered from the manifest loop the recipes recommend, five sub-plugins share one stack frame, so "missing required key: plugin_loaded_constant" identified neither the entry nor the file. All six messages take one form now, naming the entry by slug, or by bundled_plugin_file where the slug is itself the faulty key, and reporting the type received -- get_class() for objects, so a Closure and a WP_Error are told apart. The message-key rejection carries its remedy, since wrapping the text in a callable is the whole fix and the reasoning is otherwise only in a comment the host cannot see.
nikolaystrikhar
force-pushed
the
24-request-values
branch
from
August 13, 2026 13:32
1c5f360 to
bd1b5ac
Compare
nikolaystrikhar
force-pushed
the
25-config-messages
branch
from
August 13, 2026 13:32
70d59ee to
96d2909
Compare
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.
What: every
Config_Exceptionfrom theSub_Pluginconstructor names the entry it is about and the type it received.Usage:
Why this way:
A manifest loop is one stack frame for every sub-plugin in it. That shape is what the recipes recommend, and under it "missing required key: plugin_loaded_constant" identifies neither which of five entries was wrong nor which file it came from. The slug is already in the array being validated.
The fallback matters, because the slug may be the faulty key.
bundled_plugin_fileidentifies the entry just as well and names the file to go and look at; when neither can be read, the message says so rather than quietly naming nothing.The message-key rejection carries its remedy. Wrapping the text in a callable is the whole fix, and the reasoning was otherwise only in a source comment the host never sees.
get_class()for objects, so aClosureand aWP_Errorunder the same key are different mistakes rather than both "object".