lib/avro/builder/file_handler.rb in avro-builder-0.15.0 vs lib/avro/builder/file_handler.rb in avro-builder-0.16.0
- old
+ new
@@ -17,10 +17,12 @@
def read_file(name)
File.read(find_file(name))
end
+ FileNotFoundError = Class.new(StandardError)
+
def find_file(name)
# Ensure that the file_name that is searched for begins with a slash (/)
# and ends with a .rb extension. Additionally, if the name contains
# a namespace then ensure that periods (.) are replaced by forward
# slashes. E.g. for 'test.example' search for '/test/example.rb'.
@@ -29,10 +31,10 @@
Dir["#{load_path}/**/*.rb"].select do |file_path|
file_path.end_with?(file_name)
end
end.uniq
raise "Multiple matches: #{matches}" if matches.size > 1
- raise "File not found #{file_name}" if matches.empty?
+ raise FileNotFoundError.new("File not found #{file_name}") if matches.empty?
matches.first
end
private