More Sentry logging

This commit is contained in:
Shadowfacts 2021-09-22 15:06:45 -04:00
parent 64162fee92
commit 1c2ef3bc51
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 39 additions and 0 deletions

View File

@ -66,6 +66,14 @@ defmodule Frenzy.Task.CreateItem do
case result do case result do
{:error, error} -> {:error, error} ->
Logger.error(error) Logger.error(error)
if Frenzy.sentry_enabled?() do
Sentry.capture_message(
"Error evaluating pipeline '#{feed.pipeline.name}': #{inspect(error)}",
extra: %{feed_id: feed.id, pipeline_id: feed.pipeline.id}
)
end
:error :error
{:ok, item_params} -> {:ok, item_params} ->
@ -96,6 +104,12 @@ defmodule Frenzy.Task.CreateItem do
_ -> _ ->
Logger.error("Error inserting item #{item_params.guid}") Logger.error("Error inserting item #{item_params.guid}")
Logger.error(changeset.errors) Logger.error(changeset.errors)
if Frenzy.sentry_enabled?() do
Sentry.capture_message("Error inserting item '#{item_params.guid}'",
extra: %{feed_id: feed.id, errors: changeset.errors}
)
end
end end
end end
end end

View File

@ -141,8 +141,20 @@ defmodule Frenzy.UpdateFeeds do
{:ok, %Tesla.Env{status: status}} -> {:ok, %Tesla.Env{status: status}} ->
Logger.error("Couldn't load feed #{feed.feed_url}: HTTP #{status}") Logger.error("Couldn't load feed #{feed.feed_url}: HTTP #{status}")
if Frenzy.sentry_enabled?() do
Sentry.capture_message("Got HTTP #{status} when loading feed '#{feed.feed_url}'",
extra: %{feed_id: feed.id}
)
end
{:error, reason} -> {:error, reason} ->
Logger.error("Couldn't load feed #{feed.feed_url}: #{inspect(reason)}") Logger.error("Couldn't load feed #{feed.feed_url}: #{inspect(reason)}")
if Frenzy.sentry_enabled?() do
Sentry.capture_message("Error loading HTTP feed '#{feed.feed_url}': #{inspect(reason)}",
extra: %{feed_id: feed.id}
)
end
end end
end end
@ -153,6 +165,13 @@ defmodule Frenzy.UpdateFeeds do
{:error, reason} -> {:error, reason} ->
Logger.error("Couldn't load feed #{feed.feed_url}: #{inspect(reason)}") Logger.error("Couldn't load feed #{feed.feed_url}: #{inspect(reason)}")
if Frenzy.sentry_enabled?() do
Sentry.capture_message(
"Error loading Gemini feed '#{feed.feed_url}': #{inspect(reason)}",
extra: %{feed_id: feed.id}
)
end
end end
end end
@ -163,6 +182,12 @@ defmodule Frenzy.UpdateFeeds do
{:error, reason} -> {:error, reason} ->
Logger.error("Unable to parse feed at '#{feed.feed_url}': #{inspect(reason)}") Logger.error("Unable to parse feed at '#{feed.feed_url}': #{inspect(reason)}")
if Frenzy.sentry_enabled?() do
Sentry.capture_message("Unable to parse feed '#{feed.feed_url}': #{inspect(reason)}",
extra: %{feed_id: feed.id}
)
end
end end
end end