Skip to content

Adding "Field do not exists" Error to log #646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion libMBIN/Source/Template/NMSTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,14 @@ private static void EmitWarning( string msg ) {
#endif
}

private static void EmitError( string msg ) {
#if DEBUG
throw new APIException( msg );
#else
Logger.LogError( msg );
#endif
}

private static int GetArrayLength( string fieldName, NMSAttribute settings ) {
return GetEnumNames( fieldName, settings ).Length;
}
Expand Down Expand Up @@ -1735,7 +1743,8 @@ public static NMSTemplate DeserializeMXml( MXmlBase xmlData, Type templateTypeKn
// The MXML file contains a field which is no longer in the class definition.
// Raise a more helpful error.
// TODO: Raise as an actual exception.
Console.WriteLine($"[ERROR] The field '{xmlProperty.Name}' no longer exists in the class '{templateType.Name}'");
// Console.WriteLine($"[ERROR] The field '{xmlProperty.Name}' no longer exists in the class '{templateType.Name}'");
EmitError($"The field '{xmlProperty.Name}' no longer exists in the class '{templateType.Name}'");
}
object fieldValue = null;
Type fieldType = field.FieldType;
Expand Down
2 changes: 1 addition & 1 deletion libMBIN/Source/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class Version {
// the Prerelease version should be reset to 1
// When the Release version is incremented:
// the Prerelease version should be reset to 0
internal const string VERSION_STRING = "5.63.0.1";
internal const string VERSION_STRING = "5.63.0.2";

/// <summary>Shorthand for AssemblyVersion.Major</summary>
public static int Major => AssemblyVersion.Major;
Expand Down