rich media: parser: add some basic sanity checks on the returned data with pattern matching
This commit is contained in:
parent
83b7062634
commit
0f11254a06
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue