Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Discovered in #2466197: Staging directory should not have to be writeable.
Problem/Motivation
\Drupal\Core\Config\FileStorageFactory::getSync()
just throws a \Exception when the config directory type does not exist - that's way too generic.
Proposed resolution
Create a more specific exception.
Remaining tasks
Create new exception type- Review and commit
User interface changes
None
API changes
A new exception - but any code catching the existing exception will work because the new exception will extend from \Exception
Comment | File | Size | Author |
---|---|---|---|
#28 | config-2696103-28.patch | 2.54 KB | DerekCresswell |
Comments
Comment #2
Gabr1el CreditAttribution: Gabr1el for ASSIST Software SRL commentedAdded a custom exception class and used it in config_get_config_directory().
Comment #4
Gabr1el CreditAttribution: Gabr1el for ASSIST Software SRL commentedI fixed the failure reason, interdiff
Comment #5
alexpottLet's add a test for this. Would fit nicely in a KernelTest - perhaps we should add a new one in
Drupal\KernelTests\Core\Config
for this.Comment #11
chOP CreditAttribution: chOP commentedI've re-rolled this and updated the tests. This new exception now has a test for it, so removing the tag.
Completed during DrupalSouth 2018 code sprint.
Comment #13
chOP CreditAttribution: chOP at Deloitte Digital commentedRe-submitted with version 8.7.x-dev and tests passed.
Failed testing when applied to 8.6.x-dev which is expected.
Comment #16
volegerThis issue is outdated as the config_get_config_directory() function going to be removed from drupal:9.0.0
Comment #17
moshe weitzman CreditAttribution: moshe weitzman commentedUpdated title and status
Comment #19
dpiComment #20
ashok.gharpankar CreditAttribution: ashok.gharpankar as a volunteer and at Trigyn Technologies Ltd commentedComment #21
ashok.gharpankar CreditAttribution: ashok.gharpankar as a volunteer and at Trigyn Technologies Ltd commentedComment #22
ashok.gharpankar CreditAttribution: ashok.gharpankar as a volunteer and at Trigyn Technologies Ltd for Drupal India Association commentedComment #23
ashok.gharpankar CreditAttribution: ashok.gharpankar as a volunteer and at Trigyn Technologies Ltd for Drupal India Association commentedComment #24
DerekCresswell CreditAttribution: DerekCresswell as a volunteer and at Acro Commerce commentedI've changed the name of the exception based on number 5 of the list here in the coding standards.
From
InvalidConfigDirectoryTypeException
toConfigDirectoryNotDefinedException
as the subsystem is supposed to come before the error ([Subsystem][ErrorType]Exception
).Comment #25
DerekCresswell CreditAttribution: DerekCresswell as a volunteer and at Acro Commerce commentedComment #26
DerekCresswell CreditAttribution: DerekCresswell as a volunteer and at Acro Commerce commentedComment #27
andypostLast patch has no tests, which were added in #11
Comment #28
DerekCresswell CreditAttribution: DerekCresswell as a volunteer and at Acro Commerce commentedAdded back the testing of the new exception.
Comment #29
daffie CreditAttribution: daffie commentedThe patch looks good to me.
The new and more specific exception is being tested.
As stated in the IS, the change does not break BC.
Added a CR.
For me the issue is RTBC.
Comment #30
alexpottCommitted 474b03c and pushed to 9.1.x. Thanks!
Improved the test to use a more modern PHPUnit pattern.