Better error management.
This commit is contained in:
parent
01fdb317c1
commit
e2bb0b3122
10
src/ipcd.cr
10
src/ipcd.cr
@ -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
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user