Skip to content

Commit

Permalink
consistent error message formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
al2me6 committed Jul 24, 2024
1 parent 4518c16 commit 6d2ade7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Source/MaterialDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static void Load()
var property = node.GetValue("property");

if (string.IsNullOrEmpty(shader) || string.IsNullOrEmpty(property)) {
Debug.Log($"[Shabby]: invalid shader normal map property specification {shader} = {property}");
Debug.Log($"[Shabby] invalid shader normal map property specification {shader} = {property}");
} else {
normalMapProperties[shader] = property;
}
Expand Down Expand Up @@ -77,7 +77,7 @@ public MaterialDef(ConfigNode node)
if (shaderName != null) {
shader = Shabby.FindShader(shaderName);
if (shader == null) {
Debug.LogError($"[Shabby]: failed to find shader {shaderName}");
Debug.LogError($"[Shabby][MaterialDef {name}] failed to find shader {shaderName}");
}
}

Expand All @@ -97,7 +97,7 @@ public MaterialDef(ConfigNode node)
AccessTools.MethodDelegate<Func<Type, string, object>>(
AccessTools.DeclaredMethod(typeof(ConfigNode), "ReadValue"));

static Dictionary<string, T> LoadDictionary<T>(ConfigNode node, Func<string, object> parser = null)
Dictionary<string, T> LoadDictionary<T>(ConfigNode node, Func<string, object> parser = null)
{
var items = new Dictionary<string, T>();
if (node == null) return items;
Expand All @@ -107,7 +107,7 @@ static Dictionary<string, T> LoadDictionary<T>(ConfigNode node, Func<string, obj
if (value is T parsed) {
items[item.name] = parsed;
} else {
Debug.LogError($"[Shabby]: failed to parse property {item.name} = {item.value} as a {typeof(T).Name}");
Debug.LogError($"[Shabby][MaterialDef {name}] failed to parse property {item.name} = {item.value} as a {typeof(T).Name}");
}
}

Expand Down
6 changes: 3 additions & 3 deletions Source/MaterialReplacement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ public MaterialReplacement(ConfigNode node)
ConfigNode.LoadObjectFromConfig(this, node);

if (string.IsNullOrEmpty(defName)) {
Debug.LogError("[Shabby]: material replacement must reference a material definition");
Debug.LogError("[Shabby] material replacement must reference a material definition");
} else if (!MaterialDefLibrary.items.TryGetValue(defName, out materialDef)) {
Debug.LogError($"[Shabby]: failed to find material definition {defName}");
Debug.LogError($"[Shabby] failed to find material definition {defName}");
}

targetMaterials = node.GetValuesList("targetMaterial").ToHashSet();
targetTransforms = node.GetValuesList("targetTransform").ToHashSet();

if (targetMaterials.Count > 0 && targetTransforms.Count > 0) {
Debug.LogError($"[Shabby]: material replacement {defName} may not specify both materials and transforms");
Debug.LogError($"[Shabby] material replacement {defName} may not specify both materials and transforms");
targetTransforms.Clear();
}

Expand Down

0 comments on commit 6d2ade7

Please sign in to comment.