diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/EventService.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/EventService.cs index e583b1501..c4c96d7c6 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/EventService.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/EventService.cs @@ -51,6 +51,7 @@ public partial class EventService : IEventService public static implicit operator TypeStringKey(string typeName) => new(typeName); } + private ILoggerService _loggerService; private readonly AsyncReaderWriterLock _operationsLock = new(); private readonly ConcurrentDictionary, IEvent>> _subscribers = new(); private readonly ConcurrentDictionary RunnerFactory)> _luaAliasEventFactory = new(); @@ -73,6 +74,11 @@ public partial class EventService : IEventService private int _isDisposed; + public EventService(ILoggerService loggerService) + { + _loggerService = loggerService; + } + public bool IsDisposed { get => ModUtils.Threading.GetBool(ref _isDisposed); @@ -140,6 +146,7 @@ public partial class EventService : IEventService } catch (Exception e) { + _loggerService.LogError(e.Message); #if DEBUG throw; #endif @@ -282,6 +289,7 @@ public partial class EventService : IEventService catch (Exception e) { results.WithError(new ExceptionalError(e)); + _loggerService.LogError(e.Message); #if DEBUG throw; #endif