summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/fileparsing.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-07-10 19:32:45 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-07-10 19:32:45 +0000
commitfdfe0a387d95045d442b945d54a6b757b9581e2e (patch)
tree8834ef119074a2b1d32dcdbec43aef78babc7b6c /lib/puppet/util/fileparsing.rb
parent9f685e6da1f58f7011864f832e7a4a362870f93f (diff)
downloadpuppet-fdfe0a387d95045d442b945d54a6b757b9581e2e.tar.gz
puppet-fdfe0a387d95045d442b945d54a6b757b9581e2e.tar.xz
puppet-fdfe0a387d95045d442b945d54a6b757b9581e2e.zip
Adding line/file info to parsing errors in ParsedFile
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2675 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/util/fileparsing.rb')
-rw-r--r--lib/puppet/util/fileparsing.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/puppet/util/fileparsing.rb b/lib/puppet/util/fileparsing.rb
index 169320ae5..26be0f506 100644
--- a/lib/puppet/util/fileparsing.rb
+++ b/lib/puppet/util/fileparsing.rb
@@ -219,8 +219,16 @@ module Puppet::Util::FileParsing
# Split a bunch of text into lines and then parse them individually.
def parse(text)
+ count = 1
lines(text).collect do |line|
- parse_line(line)
+ count += 1
+ if val = parse_line(line)
+ val
+ else
+ error = Puppet::Error.new("Could not parse line %s" % line.inspect)
+ error.line = count
+ raise error
+ end
end
end