Some cleanup

This commit is contained in:
NeeEoo
2024-04-25 17:38:25 +02:00
parent fb8f35e2a5
commit d38ddbb2b4
7 changed files with 73 additions and 42 deletions
+8 -1
View File
@@ -521,6 +521,13 @@ class Printer {
return Type.enumEq(Tools.cleanError(e1), Tools.cleanError(e2));
}
public inline static function getPrintableError( e : Error ) {
return Tools.cleanError(switch( Tools.cleanError(e) ) {
case EPreset(msg): Parser.getBaseError(ECustom(msg.toString()));
default: e;
});
}
public static function errorToString( e : Error ) {
var message = switch( Tools.cleanError(e) ) {
case EInvalidChar(c): "Invalid character: '"+(StringTools.isEof(c) ? "EOF (End Of File)" : String.fromCharCode(c))+"' ("+c+")";
@@ -533,7 +540,7 @@ class Printer {
case EInvalidOp(op): "Invalid operator: "+op;
case EInvalidAccess(f): "Invalid access to field " + f;
case ECustom(msg): msg;
case EPreset(msg): msg;
case EPreset(msg): msg.toString();
case EInvalidClass(cla): "Invalid class: " + cla + " was not found.";
case EAlreadyExistingClass(cla): 'Custom Class named $cla already exists.';
case EInvalidEscape(s): "Invalid escape sequence: " + s;