lib/plugins/plugin_base.rb in rsence-pre-2.2.0.24 vs lib/plugins/plugin_base.rb in rsence-pre-2.2.0.25
- old
+ new
@@ -102,10 +102,20 @@
def yaml_read( path )
file_data = file_read( path )
if not file_data
return false
else
- return YAML.load( file_data )
+ begin
+ return YAML.load( file_data )
+ rescue Psych::SyntaxError => e
+ warn "Syntax Error in YAML file: #{path} (#{e.message})"
+ return false
+ rescue => e
+ warn "An exception occurred while parsing YAML file: #{path}"
+ warn e.message
+ warn " #{e.backtrace.join("\n ")}"
+ return false
+ end
end
end
# Flie writer utility.
#