Skip to content

Commit f87e101

Browse files
author
Yuriy Tkachenko
committed
Handle type errors for objects creation
1 parent b16dfc6 commit f87e101

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,15 @@ public function getDefinitions()
104104
* @param array $args
105105
*
106106
* @return object
107-
*
107+
* @throws \Exception
108108
*/
109109
protected function createObject($type, $args)
110110
{
111-
return new $type(...array_values($args));
111+
try {
112+
return new $type(...array_values($args));
113+
} catch (\Throwable $e) {
114+
throw new \Exception($e->getMessage(), null, $e);
115+
}
112116
}
113117

114118
/**

0 commit comments

Comments
 (0)