Cleaned up Warning And Error Code

This commit is contained in:
NeeEoo
2024-04-10 16:37:19 +02:00
parent a8f35ad81c
commit d955e00ece
33 changed files with 106 additions and 93 deletions
+2 -2
View File
@@ -72,7 +72,7 @@ class CoolUtil
try {
sys.FileSystem.deleteFile(delete + "/" + file);
} catch(e) {
Logs.trace("Could not delete " + delete + "/" + file, WARNING);
Logs.warn("Could not delete " + delete + "/" + file);
}
}
}
@@ -92,7 +92,7 @@ class CoolUtil
else sys.io.File.saveContent(path, content);
} catch(e) {
var errMsg:String = 'Error while trying to save the file: ${Std.string(e).replace('\n', ' ')}';
Logs.traceColored([Logs.logText(errMsg, RED)], ERROR);
Logs.error(errMsg);
if(showErrorBox) funkin.backend.utils.NativeAPI.showMessageBox("Codename Engine Warning", errMsg, MSG_WARNING);
}
#end
+2 -2
View File
@@ -79,7 +79,7 @@ class DiscordUtil
try
config = Json.parse(Assets.getText(jsonPath))
catch (e)
Logs.trace('Couldn\'t load Discord RPC configuration: ${e.toString()}', ERROR);
Logs.error('Couldn\'t load Discord RPC configuration: ${e.toString()}');
}
if (config == null)
@@ -344,7 +344,7 @@ class DiscordUtil
Logs.traceColored([
Logs.logText("[Discord] ", BLUE),
Logs.logText("Someone has just requested to join", YELLOW)
], WARNING);
], INFO);
var req:DUser = DUser.initRaw(request);
call("onJoinRequest", [req]);
+5 -5
View File
@@ -43,7 +43,7 @@ class NdllUtil {
//return Reflect.callMethod(null, func, a); // wouldnt work for some reason, maybe cause like c++ functions doesnt have reflection enabled
});
#else
Logs.trace('NDLLs are not supported on this platform.', WARNING);
Logs.warn('NDLLs are not supported on this platform.');
return noop;
#end
}
@@ -58,20 +58,20 @@ class NdllUtil {
public static function getFunctionFromPath(ndll:String, name:String, args:Int):Dynamic {
#if NDLLS_SUPPORTED
if (!Assets.exists(ndll)) {
Logs.trace('Couldn\'t find ndll at ${ndll}.', WARNING);
Logs.warn('Couldn\'t find ndll at ${ndll}.');
return noop;
}
var func = lime.system.CFFI.load(Assets.getPath(ndll), name, args);
if (func == null) {
Logs.trace('Method ${name} in ndll ${ndll} with ${args} args was not found.', ERROR);
Logs.error('Method ${name} in ndll ${ndll} with ${args} args was not found.');
return noop;
}
return func;
#else
Logs.trace('NDLLs are not supported on this platform.', WARNING);
#end
Logs.warn('NDLLs are not supported on this platform.');
return noop;
#end
}
@:dox(hide) @:noCompletion static function noop() {}
@@ -123,13 +123,12 @@ class TranslationUtil
var xml:Access = null;
try xml = new Access(Xml.parse(Assets.getText('$mainPath/$file')))
catch(e) {
var msg:String = 'Error while parsing $file: ${Std.string(e)}';
FlxG.log.error(msg);
throw new Exception(msg);
Logs.error('Error while parsing $file: ${Std.string(e)}');
return [];
}
if (xml == null) return [];
if (!xml.hasNode.translations) {
Logs.trace("A translation xml file requires a translations root element.", WARNING, YELLOW);
Logs.warn("A translation xml file requires a translations root element.");
return [];
}
@@ -138,7 +137,7 @@ class TranslationUtil
switch(node.name) {
case "trans":
if (!node.has.id) {
FlxG.log.warn("A translation node requires an ID attribute.");
Logs.warn("A translation node requires an ID attribute.");
continue;
}
+2 -2
View File
@@ -24,7 +24,7 @@ class XMLUtil {
*/
public static function applyXMLProperty(object:Dynamic, property:Access):ErrorCode {
if (!property.has.name || !property.has.type || !property.has.value) {
Logs.trace('Failed to apply XML property: XML Element is missing name, type, or value attributes.', WARNING);
Logs.warn('Failed to apply XML property: XML Element is missing name, type, or value attributes.');
return MISSING_PROPERTY;
}
@@ -57,7 +57,7 @@ class XMLUtil {
if(isPath) {
str += ' (Path: ${property.att.name})';
}
Logs.trace(str, WARNING);
Logs.warn(str);
return REFLECT_ERROR;
}
return OK;