diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2010-09-28 03:54:56 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2010-09-28 03:54:56 -0700 |
commit | 1c27512215d1436d74b9d561877684fc1b5a02e4 (patch) | |
tree | 3ae3c8a2d30edeb8f083c54e97402a3e88973e19 /lognotify.rb | |
parent | 390f2786509206022057260fe2daaec128f0ea88 (diff) | |
download | lognotify-1c27512215d1436d74b9d561877684fc1b5a02e4.tar.gz lognotify-1c27512215d1436d74b9d561877684fc1b5a02e4.tar.xz |
Better error message during parsing errors.
Diffstat (limited to 'lognotify.rb')
-rwxr-xr-x | lognotify.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lognotify.rb b/lognotify.rb index f6ad65a..fff5489 100755 --- a/lognotify.rb +++ b/lognotify.rb @@ -14,8 +14,8 @@ def parse identifier conf = Hash.new file = File.expand_path(CONFIG_DIR + '/' + identifier + '.conf') - File.open(file) do |read| - read.each_line do |line| + File.open(file) do |contents| + contents.each_line do |line| # Remove whitespace from beginning of line, allowing for indentation. line.lstrip! @@ -24,7 +24,7 @@ def parse identifier key, value = line.split('=', 2) # Raise an error if line does not contain a key/value pair. - raise 'Check line ' + read.lineno.to_s + ' for errors.' if value.nil? + raise 'Error on line ' + contents.lineno.to_s + '.' if value.nil? conf[key.strip.to_sym] = value.strip end |