lib/nanoc/data_sources/filesystem.rb in nanoc-4.2.0b1 vs lib/nanoc/data_sources/filesystem.rb in nanoc-4.2.0
- old
+ new
@@ -343,13 +343,11 @@
return ParseResult.new(content: data, attributes: {}, attributes_data: '')
end
pieces = data.split(/^(-{5}|-{3})[ \t]*\r?\n?/, 3)
if pieces.size < 4
- raise RuntimeError.new(
- "The file '#{content_filename}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format.",
- )
+ raise "The file '#{content_filename}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format."
end
meta = parse_metadata(pieces[2], content_filename)
content = pieces[4]
@@ -400,11 +398,11 @@
def read(filename)
# Read
begin
data = File.read(filename)
rescue => e
- raise RuntimeError.new("Could not read #{filename}: #{e.inspect}")
+ raise "Could not read #{filename}: #{e.inspect}"
end
# Fix
if data.respond_to?(:encode!)
if @config && @config[:encoding]
@@ -431,9 +429,9 @@
data
end
# Raises an invalid encoding error for the given filename and encoding.
def raise_encoding_error(filename, encoding)
- raise RuntimeError.new("Could not read #{filename} because the file is not valid #{encoding}.")
+ raise "Could not read #{filename} because the file is not valid #{encoding}."
end
end
end