core: fix read_file! to propagate parsing errors properly

This commit is contained in:
Marcel Otto 2017-05-15 22:48:55 +02:00
parent 8eb15b581b
commit a5fc5aa607

View file

@ -31,9 +31,8 @@ defmodule RDF.Serialization.Reader do
end end
def read_file!(decoder, file, opts \\ []) do def read_file!(decoder, file, opts \\ []) do
case read_file(decoder, file, opts) do with content = File.read!(file) do
{:ok, graph} -> graph read_string!(decoder, content, opts)
{:error, reason} -> raise File.Error, path: file, action: "read", reason: reason
end end
end end