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
def read_file!(decoder, file, opts \\ []) do
case read_file(decoder, file, opts) do
{:ok, graph} -> graph
{:error, reason} -> raise File.Error, path: file, action: "read", reason: reason
with content = File.read!(file) do
read_string!(decoder, content, opts)
end
end