Skip to content

Commit 6ef30b9

Browse files
committed
Merge pull request #158 from ppi/tests-dispatch
Additional error handling for invalid modules
2 parents f2388cc + 50c2186 commit 6ef30b9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Module/Controller/ControllerNameParser.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ private function getPartsFromControllerName($controller)
8585
list($moduleName, $controller, $action) = $parts;
8686
$controller = str_replace('/', '\\', $controller);
8787
$module = $this->moduleManager->getModule($moduleName);
88+
89+
if (!is_object($module)) {
90+
throw new \RuntimeException(sprintf(
91+
'Unable to locate module: %s, when parsing controller: %s',
92+
$moduleName, $controller
93+
));
94+
}
95+
8896
$moduleName = $module->getName();
8997

9098
return [$module, $moduleName, $controller, $action];

0 commit comments

Comments
 (0)