File tree Expand file tree Collapse file tree 1 file changed +12
-19
lines changed
lib/internal/Magento/Framework/ObjectManager/Factory Expand file tree Collapse file tree 1 file changed +12
-19
lines changed Original file line number Diff line number Diff line change 77
88use Magento \Framework \Exception \RuntimeException ;
99use Magento \Framework \ObjectManagerInterface ;
10+ use Magento \Framework \Phrase ;
1011use Psr \Log \LoggerInterface ;
12+ use Magento \Framework \App \ObjectManager ;
1113
1214abstract class AbstractFactory implements \Magento \Framework \ObjectManager \FactoryInterface
1315{
@@ -106,34 +108,25 @@ public function getDefinitions()
106108 * @param array $args
107109 *
108110 * @return object
109- * @throws \Exception
111+ * @throws RuntimeException
110112 */
111113 protected function createObject ($ type , $ args )
112114 {
113115 try {
114116 return new $ type (...array_values ($ args ));
115117 } catch (\Throwable $ 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 ()));
118+ /** @var LoggerInterface $logger */
119+ $ logger = ObjectManager::getInstance ()->get (LoggerInterface::class);
120+ $ logger ->critical (
121+ sprintf ('Create object error: %s, %s ' , $ type , $ e ->getMessage ())
122+ );
123+
124+ throw new RuntimeException (
125+ new Phrase ('Create object error ' )
126+ );
124127 }
125128 }
126129
127- /**
128- * Logger Instance
129- *
130- * @return LoggerInterface
131- */
132- protected function getLogger ()
133- {
134- return $ this ->objectManager ->get (LoggerInterface::class);
135- }
136-
137130 /**
138131 * Resolve an argument
139132 *
You can’t perform that action at this time.
0 commit comments