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
|
unless File.directory? directory
|
||||||
raise "not a valid directory: #{directory}"
|
raise "not a valid directory: #{directory}"
|
||||||
end
|
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
|
@rules << r
|
||||||
end
|
end
|
||||||
|
rescue e
|
||||||
|
Baguette::Log.error "reading directory #{directory}: #{e}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_redirection_files(directory : String)
|
def parse_redirection_files(directory : String)
|
||||||
unless File.directory? directory
|
unless File.directory? directory
|
||||||
raise "not a valid directory: #{directory}"
|
raise "not a valid directory: #{directory}"
|
||||||
end
|
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
|
@redirections << r
|
||||||
end
|
end
|
||||||
|
rescue e
|
||||||
|
Baguette::Log.error "reading directory #{directory}: #{e}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user