Let errors thrown in debug hooks bubble up to the running coroutine.

This commit is contained in:
James Roseborough
2013-12-30 23:58:02 +00:00
parent 18c1116d22
commit b0d52fe118
4 changed files with 6 additions and 5 deletions

View File

@@ -909,6 +909,7 @@ Files are no longer hosted at LuaForge.
<li>Fix os.time() to return a number of seconds.</li> <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>Implement formatting with os.date(), and table argument for os.time().</li>
<li>Refactor APIs related to compiling and loading scripts.</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> </ul></td></tr>
</table></td></tr></table> </table></td></tr></table>

View File

@@ -21,7 +21,6 @@
******************************************************************************/ ******************************************************************************/
package org.luaj.vm2; package org.luaj.vm2;
import org.luaj.vm2.lib.DebugLib;
/** /**
* RuntimeException that is thrown and caught in response to a lua error. * RuntimeException that is thrown and caught in response to a lua error.

View File

@@ -24,8 +24,6 @@ package org.luaj.vm2;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import org.luaj.vm2.lib.DebugLib;
/** /**
* Subclass of {@link LuaValue} that implements * Subclass of {@link LuaValue} that implements
* a lua coroutine thread using Java Threads. * a lua coroutine thread using Java Threads.

View File

@@ -25,6 +25,7 @@ import org.luaj.vm2.Globals;
import org.luaj.vm2.Lua; import org.luaj.vm2.Lua;
import org.luaj.vm2.LuaBoolean; import org.luaj.vm2.LuaBoolean;
import org.luaj.vm2.LuaClosure; import org.luaj.vm2.LuaClosure;
import org.luaj.vm2.LuaError;
import org.luaj.vm2.LuaFunction; import org.luaj.vm2.LuaFunction;
import org.luaj.vm2.LuaNil; import org.luaj.vm2.LuaNil;
import org.luaj.vm2.LuaNumber; import org.luaj.vm2.LuaNumber;
@@ -432,8 +433,10 @@ public class DebugLib extends TwoArgFunction {
t.inhook = true; t.inhook = true;
try { try {
t.hookfunc.call(type, arg); t.hookfunc.call(type, arg);
} catch (Exception e) { } catch (LuaError e) {
e.printStackTrace(); throw e;
} catch (RuntimeException e) {
throw new LuaError(e);
} finally { } finally {
t.inhook = false; t.inhook = false;
} }