Let errors thrown in debug hooks bubble up to the running coroutine.
This commit is contained in:
@@ -909,6 +909,7 @@ Files are no longer hosted at LuaForge.
|
||||
<li>Fix os.time() to return a number of seconds.</li>
|
||||
<li>Implement formatting with os.date(), and table argument for os.time().</li>
|
||||
<li>Refactor APIs related to compiling and loading scripts.</li>
|
||||
<li>Let errors thrown in debug hooks bubble up to the running coroutine.</li>
|
||||
|
||||
</ul></td></tr>
|
||||
</table></td></tr></table>
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
******************************************************************************/
|
||||
package org.luaj.vm2;
|
||||
|
||||
import org.luaj.vm2.lib.DebugLib;
|
||||
|
||||
/**
|
||||
* RuntimeException that is thrown and caught in response to a lua error.
|
||||
|
||||
@@ -24,8 +24,6 @@ package org.luaj.vm2;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import org.luaj.vm2.lib.DebugLib;
|
||||
|
||||
/**
|
||||
* Subclass of {@link LuaValue} that implements
|
||||
* a lua coroutine thread using Java Threads.
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.luaj.vm2.Globals;
|
||||
import org.luaj.vm2.Lua;
|
||||
import org.luaj.vm2.LuaBoolean;
|
||||
import org.luaj.vm2.LuaClosure;
|
||||
import org.luaj.vm2.LuaError;
|
||||
import org.luaj.vm2.LuaFunction;
|
||||
import org.luaj.vm2.LuaNil;
|
||||
import org.luaj.vm2.LuaNumber;
|
||||
@@ -432,8 +433,10 @@ public class DebugLib extends TwoArgFunction {
|
||||
t.inhook = true;
|
||||
try {
|
||||
t.hookfunc.call(type, arg);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} catch (LuaError e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new LuaError(e);
|
||||
} finally {
|
||||
t.inhook = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user