From 6f688275c5ab02ead376bc444bacd2969920b932 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 16 Mar 2012 18:02:03 +1300 Subject: [PATCH] include source location when complaining about bad miniyaml indents --- OpenRA.FileFormats/MiniYaml.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenRA.FileFormats/MiniYaml.cs b/OpenRA.FileFormats/MiniYaml.cs index d999533d69..1807c05f77 100755 --- a/OpenRA.FileFormats/MiniYaml.cs +++ b/OpenRA.FileFormats/MiniYaml.cs @@ -112,15 +112,16 @@ namespace OpenRA.FileFormats if (t.Length == 0 || t[0] == '#') continue; var level = line.Length - t.Length; + var location = new MiniYamlNode.SourceLocation { Filename = filename, Line = lineNo }; if (levels.Count <= level) - throw new YamlException("Bad indent in miniyaml"); + throw new YamlException("Bad indent in miniyaml at {0}".F (location)); while (levels.Count > level + 1) levels.RemoveAt(levels.Count - 1); var d = new List(); var rhs = SplitAtColon( ref t ); - levels[ level ].Add( new MiniYamlNode( t, rhs, d, new MiniYamlNode.SourceLocation { Filename = filename, Line = lineNo } ) ); + levels[ level ].Add( new MiniYamlNode( t, rhs, d, location ) ); levels.Add(d); }