Browse Source

Change: InvalidOperationException -> LuaRuntimeException

AnnulusGames 1 year ago
parent
commit
f477d29f38
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/Lua/LuaCoroutine.cs

+ 3 - 3
src/Lua/LuaCoroutine.cs

@@ -89,7 +89,7 @@ public sealed class LuaCoroutine : LuaThread, IValueTaskSource<LuaCoroutine.Yiel
                     }
                     }
                     else
                     else
                     {
                     {
-                        throw new InvalidOperationException("cannot resume non-suspended coroutine");
+                        throw new LuaRuntimeException(context.State.GetTraceback(), "cannot resume non-suspended coroutine");
                     }
                     }
                 case LuaThreadStatus.Dead:
                 case LuaThreadStatus.Dead:
                     if (IsProtectedMode)
                     if (IsProtectedMode)
@@ -100,7 +100,7 @@ public sealed class LuaCoroutine : LuaThread, IValueTaskSource<LuaCoroutine.Yiel
                     }
                     }
                     else
                     else
                     {
                     {
-                        throw new InvalidOperationException("cannot resume dead coroutine");
+                        throw new LuaRuntimeException(context.State.GetTraceback(), "cannot resume dead coroutine");
                     }
                     }
             }
             }
 
 
@@ -222,7 +222,7 @@ public sealed class LuaCoroutine : LuaThread, IValueTaskSource<LuaCoroutine.Yiel
     {
     {
         if (Volatile.Read(ref status) != (byte)LuaThreadStatus.Running)
         if (Volatile.Read(ref status) != (byte)LuaThreadStatus.Running)
         {
         {
-            throw new InvalidOperationException("cannot call yield on a coroutine that is not currently running");
+            throw new LuaRuntimeException(context.State.GetTraceback(), "cannot call yield on a coroutine that is not currently running");
         }
         }
 
 
         resume.SetResult(new()
         resume.SetResult(new()