瀏覽代碼

break on exception thrown

Nicolas Cannasse 7 年之前
父節點
當前提交
1e5545e611
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      hxd/System.hl.hx

+ 3 - 0
hxd/System.hl.hx

@@ -113,11 +113,14 @@ class System {
 	}
 
 	static function runMainLoop() {
+		var reportError = function(e) reportError(e);
 		while( true ) {
 			try {
+				hl.Api.setErrorHandler(reportError); // set exception trap
 				@:privateAccess haxe.MainLoop.tick();
 				if( !mainLoop() ) break;
 			} catch( e : Dynamic ) {
+				hl.Api.setErrorHandler(null);
 				reportError(e);
 			}
 		}