Problem/Motivation
When a split is configured to use folder storage, but no path has been set, this leads to an unhelpful error message:
TypeError: Drupal\config_split\ConfigSplitManager::singleImportOrActivate(): Argument #2 ($storage) must be of type Drupal\Core\Config\StorageInterface, null given
While it is the developer's responsibility to set up a correct configuration, it would be nice to point out exactly what is wrong.
Steps to reproduce
- Configure a split to use folder storage, but set the folder path to an empty string.
- Activate the split.
Proposed resolution
We can introduce an assert()
that checks whether the path is configured. This is a low impact improvement which will show up only on developer environments, as opposed to introducing an exception which is technically an API change.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3388784-2.patch | 739 bytes | pfrenssen |
Comments
Comment #2
pfrenssenComment #3
pfrenssenComment #4
bircherThanks for opening this issue and providing a patch.
This is a good compromise between making it more obvious what is going on and keeping it simple.
Just out of curiosity, I thought the folder was required when selecting the folder in the form, but how difficult would it be to add some config validation. I know core is on the way to make config validation much more of a thing so maybe that would be a good thing to add. Of course we can do that in a follow up issue too.
I'll commit this next time I work on config split
Comment #6
bircher