diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Plugins/CsPackageManager.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Plugins/CsPackageManager.cs index 8ba1f8921c..de2e2beea0 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Plugins/CsPackageManager.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Plugins/CsPackageManager.cs @@ -5,6 +5,7 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Diagnostics; using System.Runtime.CompilerServices; using System.Text; using System.Threading; @@ -830,8 +831,17 @@ private void TryRun(Action action, string messageMethodName, string messageTypeN } catch (Exception e) { + StackTrace st = new StackTrace(e); + String s = String.Join('\n', + st.GetFrames().SkipLast(2) + .Select(f => $" at {f.GetMethod().DeclaringType}.{f.GetMethod().Name}()") + ); + ModUtils.Logging.PrintError($"{nameof(CsPackageManager)}: Error while running {messageMethodName}() on plugin of type {messageTypeName}"); - ModUtils.Logging.PrintError($"{nameof(CsPackageManager)}: Details: {e.Message} | {e.InnerException}"); + ModUtils.Logging.PrintError($"{nameof(CsPackageManager)}: Details: {e.Message}\n{s}"); + if(e.InnerException != null){ + ModUtils.Logging.PrintError($"{nameof(CsPackageManager)}: Inner Exception: {e.InnerException}"); + } } }