From e252f1a3cd109e0cc758ff8b30af9b3a2541adbb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 17 Mar 2022 18:40:26 +0900 Subject: [PATCH] Add explanation about try-catch logic in `SkinComponentToolbox` --- osu.Game/Skinning/Editor/SkinComponentToolbox.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Skinning/Editor/SkinComponentToolbox.cs b/osu.Game/Skinning/Editor/SkinComponentToolbox.cs index 9c4a369c1d..a586cdcd54 100644 --- a/osu.Game/Skinning/Editor/SkinComponentToolbox.cs +++ b/osu.Game/Skinning/Editor/SkinComponentToolbox.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; +using osu.Framework.Logging; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -74,8 +75,14 @@ private void attemptAddComponent(Type type) RequestPlacement = t => RequestPlacement?.Invoke(t) }); } - catch + catch (DependencyNotRegisteredException) { + // This loading code relies on try-catching any dependency injection errors to know which components are valid for the current target screen. + // If a screen can't provide the required dependencies, a skinnable component should not be displayed in the list. + } + catch (Exception e) + { + Logger.Error(e, $"Skin component {type} could not be loaded in the editor component list due to an error"); } }