Fix bug
Co-Authored-By: Mihai Alexandru <77043862+majigsaw77@users.noreply.github.com>
This commit is contained in:
co-authored by
Mihai Alexandru
parent
883b2f2b3c
commit
dcd3e02cd3
@@ -11,7 +11,7 @@ import haxe.CallStack;
|
|||||||
|
|
||||||
class CrashHandler {
|
class CrashHandler {
|
||||||
public static function init() {
|
public static function init() {
|
||||||
Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onError);
|
Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onUncaughtError);
|
||||||
#if cpp
|
#if cpp
|
||||||
untyped __global__.__hxcpp_set_critical_error_handler(onError);
|
untyped __global__.__hxcpp_set_critical_error_handler(onError);
|
||||||
#elseif hl
|
#elseif hl
|
||||||
@@ -19,7 +19,7 @@ class CrashHandler {
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function onError(e:UncaughtErrorEvent) {
|
public static function onUncaughtError(e:UncaughtErrorEvent) {
|
||||||
var m:String = e.error;
|
var m:String = e.error;
|
||||||
if (Std.isOfType(e.error, Error)) {
|
if (Std.isOfType(e.error, Error)) {
|
||||||
var err = cast(e.error, Error);
|
var err = cast(e.error, Error);
|
||||||
@@ -58,4 +58,11 @@ class CrashHandler {
|
|||||||
Sys.exit(1);
|
Sys.exit(1);
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (cpp || hl)
|
||||||
|
private static function onError(message:Dynamic):Void
|
||||||
|
{
|
||||||
|
throw Std.string(message);
|
||||||
|
}
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user