Skip to content
Snippets Groups Projects
Commit de426466 authored by kaniini's avatar kaniini
Browse files

rich media: add try/rescue to ensure we catch parsing and fetching failures

parent 5d895093
No related branches found
No related tags found
No related merge requests found
......@@ -21,9 +21,14 @@ defmodule Pleroma.Web.RichMedia.Parser do
end
defp parse_url(url) do
{:ok, %Tesla.Env{body: html}} = Pleroma.HTTP.get(url)
try do
{:ok, %Tesla.Env{body: html}} = Pleroma.HTTP.get(url)
html |> maybe_parse() |> get_parsed_data()
html |> maybe_parse() |> get_parsed_data()
rescue
_e ->
{:error, "Parsing error"}
end
end
defp maybe_parse(html) do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment