Skip to content

Commit 1524190

Browse files
author
Oleksii Korshenko
authored
MAGETWO-87908: Display a more meaningful error message in case of misspelt module name magento#12843
2 parents 62b2832 + b9e0483 commit 1524190

File tree

1 file changed

+6
-0
lines changed
  • lib/internal/Magento/Framework/Module

1 file changed

+6
-0
lines changed

lib/internal/Magento/Framework/Module/Dir.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ public function getDir($moduleName, $type = '')
4545
{
4646
$path = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, $moduleName);
4747

48+
// An empty $type means it's getting the directory of the module itself.
49+
if (empty($type) && !isset($path)) {
50+
// Note: do not throw \LogicException, as it would break backwards-compatibility.
51+
throw new \InvalidArgumentException("Module '$moduleName' is not correctly registered.");
52+
}
53+
4854
if ($type) {
4955
if (!in_array($type, [
5056
self::MODULE_ETC_DIR,

0 commit comments

Comments
 (0)