File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
lib/internal/Magento/Framework/ObjectManager/Factory Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 55 */
66namespace Magento \Framework \ObjectManager \Factory ;
77
8+ use Magento \Framework \Exception \RuntimeException ;
89use Magento \Framework \ObjectManagerInterface ;
10+ use Psr \Log \LoggerInterface ;
911
1012abstract class AbstractFactory implements \Magento \Framework \ObjectManager \FactoryInterface
1113{
@@ -111,10 +113,27 @@ protected function createObject($type, $args)
111113 try {
112114 return new $ type (...array_values ($ args ));
113115 } catch (\Throwable $ e ) {
114- throw new \Exception ($ e ->getMessage (), null , $ e );
116+ $ this ->getLogger ()->critical (__ (
117+ 'Object create error: %1, %2 ' ,
118+ [
119+ $ type ,
120+ $ e ->getMessage ()
121+ ]
122+ ));
123+ throw new RuntimeException (__ ($ e ->getMessage ()));
115124 }
116125 }
117126
127+ /**
128+ * Logger Instance
129+ *
130+ * @return LoggerInterface
131+ */
132+ protected function getLogger ()
133+ {
134+ return $ this ->objectManager ->get (LoggerInterface::class);
135+ }
136+
118137 /**
119138 * Resolve an argument
120139 *
You can’t perform that action at this time.
0 commit comments