-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Display a more meaningful error message in case of misspelt module name #12843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[LogicException] Component 'VendorA_ModuleB' of type '' is not correctly registered. instead of [Magento\Framework\Exception\FileSystemException] The file "/composer.json" doesn't exist
Jānis Elmeris seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
@@ -45,6 +45,10 @@ public function getDir($moduleName, $type = '') | |||
{ | |||
$path = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, $moduleName); | |||
|
|||
if (! isset($path)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove space before isset function, it's not needed there
@@ -45,6 +45,10 @@ public function getDir($moduleName, $type = '') | |||
{ | |||
$path = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, $moduleName); | |||
|
|||
if (! isset($path)) { | |||
throw new \LogicException("Component '$moduleName' of type '$type' is not correctly registered."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not backward compatible, you're adding new exception type that could be thrown. I think it would be better to use \InvalidArgumentException
in order to keep backward compatibility there.
Hi @ihor-sviziev, thank you for the review. |
…spelt module name #12843
Description
Displays a more meaningful error message in case of misspelt module name.
[LogicException] Component 'VendorA_ModuleB' of type '' is not correctly registered.
instead of
[Magento\Framework\Exception\FileSystemException] The file "/composer.json" doesn't exist
Manual testing scenarios
bin/magento module:disable Magento_Bundle
(orbin/magento module:enable Magento_Bundle
, if it is disabled); yes, it does not have to be the same incorrectly configured module, any will do.