Replace the application popup.

This commit is contained in:
MAJigsaw77
2025-08-05 01:14:22 -04:00
committed by Eric
parent e16391a05c
commit bb7b00cf77
8 changed files with 68 additions and 48 deletions
+4 -18
View File
@@ -5,19 +5,6 @@ import polymod.Polymod;
@:nullSafety
class PolymodErrorHandler
{
/**
* Show a popup with the given text.
* This displays a system popup, it WILL interrupt the game.
* Make sure to only use this when it's important, like when there's a script error.
*
* @param name The name at the top of the popup.
* @param desc The body text of the popup.
*/
public static function showAlert(name:String, desc:String):Void
{
lime.app.Application.current.window.alert(desc, name);
}
public static function onPolymodError(error:PolymodError):Void
{
// Perform an action based on the error code.
@@ -37,12 +24,12 @@ class PolymodErrorHandler
// A syntax error when parsing a script.
logError(error.message);
// Notify the user via popup.
showAlert('Polymod Script Parsing Error', error.message);
funkin.util.WindowUtil.showError('Polymod Script Parsing Error', error.message);
case SCRIPT_RUNTIME_EXCEPTION:
// A runtime error when running a script.
logError(error.message);
// Notify the user via popup.
showAlert('Polymod Script Exception', error.message);
funkin.util.WindowUtil.showError('Polymod Script Exception', error.message);
case SCRIPT_CLASS_MODULE_NOT_FOUND:
// A scripted class tried to reference an unknown class or module.
logError(error.message);
@@ -54,13 +41,12 @@ class PolymodErrorHandler
msg += '\nCheck to ensure the class exists and is spelled correctly.';
// Notify the user via popup.
showAlert('Polymod Script Import Error', msg);
funkin.util.WindowUtil.showError('Polymod Script Import Error', msg);
case SCRIPT_CLASS_MODULE_BLACKLISTED:
// A scripted class tried to reference a blacklisted class or module.
logError(error.message);
// Notify the user via popup.
showAlert('Polymod Script Blacklist Violation', error.message);
funkin.util.WindowUtil.showError('Polymod Script Blacklist Violation', error.message);
default:
// Log the message based on its severity.
switch (error.severity)