fix: add error handling for initializer method invocation in InitializerProcessor
- Log errors when initializer method invocation fails - Re-throw exception after logging
This commit is contained in:
@@ -167,7 +167,13 @@ final readonly class InitializerProcessor
|
||||
|
||||
$factory = function ($container) use ($className, $methodName, $returnType) {
|
||||
|
||||
$instance = $container->invoker->invoke(ClassName::create($className), $methodName);
|
||||
try {
|
||||
$instance = $container->invoker->invoke(ClassName::create($className), $methodName);
|
||||
} catch (\Throwable $e) {
|
||||
$container->get(Logger::class)->error("Failed to invoke initializer method {$methodName} for class {$className}: {$e->getMessage()}");
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
// Wenn das ein Interface ist, registriere auch die konkrete Klasse automatisch
|
||||
if (interface_exists($returnType)) {
|
||||
|
||||
Reference in New Issue
Block a user