Skip to content

Commit b9e0483

Browse files
MAGETWO-87908: Display a more meaningful error message in case of misspelt module name magento#12843
- Merge Pull Request magento#12843 from JanisE/magento2:2.2-develop - Merged commits: 1. ef525e5 2. ae3cbb9 3. 36268c6 4. 196f691 5. 9c5975d
2 parents dcd0dbc + 9c5975d commit b9e0483

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

+6
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)