diff --git a/source/Main.hx b/source/Main.hx index 5c288f0f..6b208997 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -153,6 +153,9 @@ class Main extends Sprite { #if CRASH_HANDLER Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onCrash); + #if cpp + untyped __global__.__hxcpp_set_critical_error_handler(onError); + #end #end #if DISCORD_ALLOWED DiscordClient.prepare(); #end @@ -224,4 +227,11 @@ class Main extends Sprite { Sys.exit(1); } #end + + #if cpp + private static function onError(message:Dynamic):Void + { + throw Std.string(message); + } + #end }