Archived
3
0

Better error management.

This commit is contained in:
Karchnu 2020-11-03 19:11:01 +01:00
parent 01fdb317c1
commit e2bb0b3122

View File

@ -44,18 +44,24 @@ module IPCd
unless File.directory? directory
raise "not a valid directory: #{directory}"
end
Array(Rule).from_yaml_files(Dir.new(directory).entries).each do |r|
files = Dir.new(directory).children.map {|f| directory + "/" + f }
Array(Rule).from_yaml_files(files).each do |r|
@rules << r
end
rescue e
Baguette::Log.error "reading directory #{directory}: #{e}"
end
def parse_redirection_files(directory : String)
unless File.directory? directory
raise "not a valid directory: #{directory}"
end
Array(Redirection).from_yaml_files(Dir.new(directory).entries).each do |r|
files = Dir.new(directory).children.map {|f| directory + "/" + f }
Array(Redirection).from_yaml_files(files).each do |r|
@redirections << r
end
rescue e
Baguette::Log.error "reading directory #{directory}: #{e}"
end