Skip to content

Commit

Permalink
Merge pull request #45 from mewlist/exceptions
Browse files Browse the repository at this point in the history
Exceptions
  • Loading branch information
mewlist authored Feb 23, 2024
2 parents 6d01dad + ffe101e commit 0591e98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions Runtime/Context/SceneContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ await Task.WhenAll(injectableComponents.Select(x
await Shutdown();
return;
}
throw;
}
using (new ContextSpaceScope(this))
{
Expand Down
12 changes: 10 additions & 2 deletions Runtime/DIContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,16 @@ Component component
if (go.GetComponent(typeof(IGameObjectContextRoot)))
return instance;

foreach (var component in go.GetComponentsInChildren(typeof(IInjectableComponent)))
await InjectIntoAsync(component, args);
try
{
foreach (var component in go.GetComponentsInChildren(typeof(IInjectableComponent)))
await InjectIntoAsync(component, args);
}
catch (Exception e)
{
Object.Destroy(prefabInstance);
throw e;
}

return instance;
}
Expand Down

0 comments on commit 0591e98

Please sign in to comment.