GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
refactor(infra): removed centralised error handling in Bus service
Lars13a277340229
diff --git a/LarsWM.Infrastructure/Bussing/Bus.cs b/LarsWM.Infrastructure/Bussing/Bus.csindex 38d1ca0c..5da2d223 100644--- a/LarsWM.Infrastructure/Bussing/Bus.cs+++ b/LarsWM.Infrastructure/Bussing/Bus.cs@@ -32,17 +32,11 @@ namespace LarsWM.Infrastructure.Bussingthrow new Exception("Only one CommandHandler can be registered to handle a Command.");}- try- {- Debug.WriteLine($"Command {command.Name} invoked.");- ICommandHandler<T> handlerInstance = ServiceLocator.Provider.GetRequiredService(handlers[0]) as ICommandHandler<T>;- return handlerInstance.Handle(command);- }- catch (Exception exception)- {- // TODO: Add centralised error handling here?- throw exception;- }+ // TODO: Add centralised error handling here?+ Debug.WriteLine($"Command {command.Name} invoked.");++ ICommandHandler<T> handlerInstance = ServiceLocator.Provider.GetRequiredService(handlers[0]) as ICommandHandler<T>;+ return handlerInstance.Handle(command);}/// <summary>@@ -58,19 +52,13 @@ namespace LarsWM.Infrastructure.Bussingvar handlersToCall = _registeredEventHandlers.Where(handler => handlerTypeToCall.IsAssignableFrom(handler));- try- {- Debug.WriteLine($"Event {@event.Name} emitted.");- foreach (var handler in handlersToCall)- {- IEventHandler<T> handlerInstance = ServiceLocator.Provider.GetService(handler) as IEventHandler<T>;- handlerInstance.Handle(@event);- }- }- catch (Exception exception)+ Debug.WriteLine($"Event {@event.Name} emitted.");++ // TODO: Add centralised error handling here?+ foreach (var handler in handlersToCall){- // TODO: Add centralised error handling here?- throw exception;+ IEventHandler<T> handlerInstance = ServiceLocator.Provider.GetService(handler) as IEventHandler<T>;+ handlerInstance.Handle(@event);}}