rich media: parser: add some basic sanity checks on the returned data with pattern matching

This commit is contained in:
William Pitcock 2019-01-28 20:31:43 +00:00
parent 83b7062634
commit 0f11254a06

View File

@ -46,11 +46,11 @@ defp maybe_parse(html) do
end) end)
end end
defp get_parsed_data(data) when data == %{} do defp get_parsed_data(%{title: title} = data) when is_binary(title) and byte_size(title) > 0 do
{:error, "No metadata found"} {:ok, data}
end end
defp get_parsed_data(data) do defp get_parsed_data(data) do
{:ok, data} {:error, "Found metadata was invalid or incomplete: #{inspect(data)}"}
end end
end end