Przeglądaj źródła

Fix reportError before main loop missing callstack

Yuxiao Mao 1 rok temu
rodzic
commit
0956f70c26
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      hxd/System.hl.hx

+ 6 - 1
hxd/System.hl.hx

@@ -463,7 +463,12 @@ class System {
 
 
 	static function __init__() {
 	static function __init__() {
 		#if !usesys
 		#if !usesys
-		hl.Api.setErrorHandler(function(e) reportError(e)); // initialization error
+		#if (haxe_ver >= 4.1)
+		var reportError = function(e:Dynamic) reportError((e is haxe.Exception)?e:new haxe.Exception(Std.string(e),null,e));
+		#else
+		var reportError = function(e) reportError(e);
+		#end
+		hl.Api.setErrorHandler(reportError); // initialization error
 		sentinel = new hl.UI.Sentinel(30, function() throw "Program timeout (infinite loop?)");
 		sentinel = new hl.UI.Sentinel(30, function() throw "Program timeout (infinite loop?)");
 		#end
 		#end
 		#if ( target.threaded && (haxe_ver >= 4.2) )
 		#if ( target.threaded && (haxe_ver >= 4.2) )