Skip to content

Commit bd7ab8c

Browse files
authored
Merge pull request #646 from HolterPhylo/FieldDoNotExistError
Adding "Field do not exists" Error to log
2 parents 04ccfc5 + f54357c commit bd7ab8c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

libMBIN/Source/Template/NMSTemplate.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,14 @@ private static void EmitWarning( string msg ) {
14731473
#endif
14741474
}
14751475

1476+
private static void EmitError( string msg ) {
1477+
#if DEBUG
1478+
throw new APIException( msg );
1479+
#else
1480+
Logger.LogError( msg );
1481+
#endif
1482+
}
1483+
14761484
private static int GetArrayLength( string fieldName, NMSAttribute settings ) {
14771485
return GetEnumNames( fieldName, settings ).Length;
14781486
}
@@ -1735,7 +1743,8 @@ public static NMSTemplate DeserializeMXml( MXmlBase xmlData, Type templateTypeKn
17351743
// The MXML file contains a field which is no longer in the class definition.
17361744
// Raise a more helpful error.
17371745
// TODO: Raise as an actual exception.
1738-
Console.WriteLine($"[ERROR] The field '{xmlProperty.Name}' no longer exists in the class '{templateType.Name}'");
1746+
// Console.WriteLine($"[ERROR] The field '{xmlProperty.Name}' no longer exists in the class '{templateType.Name}'");
1747+
EmitError($"The field '{xmlProperty.Name}' no longer exists in the class '{templateType.Name}'");
17391748
}
17401749
object fieldValue = null;
17411750
Type fieldType = field.FieldType;

libMBIN/Source/Version.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static class Version {
2626
// When the Release version is incremented:
2727
// the Prerelease version should be reset to 0
2828
internal const string VERSION_STRING = "5.71.0.1";
29-
29+
3030
/// <summary>Shorthand for AssemblyVersion.Major</summary>
3131
public static int Major => AssemblyVersion.Major;
3232
/// <summary>Shorthand for AssemblyVersion.Minor</summary>

0 commit comments

Comments
 (0)