From dcd3e02cd398122a18e21fd2a3d43ef048d75cfa Mon Sep 17 00:00:00 2001 From: NeeEoo Date: Fri, 28 Jul 2023 20:55:39 +0200 Subject: [PATCH] Fix bug Co-Authored-By: Mihai Alexandru <77043862+majigsaw77@users.noreply.github.com> --- source/funkin/backend/system/modules/CrashHandler.hx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/system/modules/CrashHandler.hx b/source/funkin/backend/system/modules/CrashHandler.hx index 3f64f779..5911c2d9 100644 --- a/source/funkin/backend/system/modules/CrashHandler.hx +++ b/source/funkin/backend/system/modules/CrashHandler.hx @@ -11,7 +11,7 @@ import haxe.CallStack; class CrashHandler { public static function init() { - Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onError); + Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, onUncaughtError); #if cpp untyped __global__.__hxcpp_set_critical_error_handler(onError); #elseif hl @@ -19,7 +19,7 @@ class CrashHandler { #end } - public static function onError(e:UncaughtErrorEvent) { + public static function onUncaughtError(e:UncaughtErrorEvent) { var m:String = e.error; if (Std.isOfType(e.error, Error)) { var err = cast(e.error, Error); @@ -58,4 +58,11 @@ class CrashHandler { Sys.exit(1); #end } + + #if (cpp || hl) + private static function onError(message:Dynamic):Void + { + throw Std.string(message); + } + #end } \ No newline at end of file