Browse Source

fix: fix LuaRuntimeException handling from other exception

Akeit0 7 months ago
parent
commit
c7e3e8c7d0
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/Lua/Exceptions.cs

+ 7 - 0
src/Lua/Exceptions.cs

@@ -77,6 +77,13 @@ public class LuaRuntimeException : Exception, ILuaTracebackBuildable
 {
     public LuaRuntimeException(LuaThread? thread, Exception innerException) : base(innerException.Message, innerException)
     {
+        if (thread != null)
+        {
+            thread.CurrentException?.BuildOrGet();
+            thread.ExceptionTrace.Clear();
+            thread.CurrentException = this;
+        }
+
         Thread = thread;
     }