Skip to content

Commit

Permalink
tweak: Is it valuable to log on trip mod publication success / failure?
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahpurcell committed Feb 4, 2025
1 parent f10aea6 commit c2ac232
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/skate_web/controllers/detours_controller.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule SkateWeb.DetoursController do
require Logger
alias Realtime.Shape
alias Realtime.TripModification
alias Skate.OpenRouteServiceAPI
Expand Down Expand Up @@ -122,10 +123,20 @@ defmodule SkateWeb.DetoursController do
shape_id: shape_id
}) do
try do
trip_modification_publisher().publish_modification(modification, shape, is_draft?: true)
case trip_modification_publisher().publish_modification(modification, shape,
is_draft?: true
) do
{:ok, _} ->
Logger.info(fn -> "publish_modification: message successfully sent" end)

{{:error, error}, _} ->
Logger.warning(fn -> "publish_modification returned error: #{error}" end)
end
catch
# May throw if the publishing server doesn't exist, which we can ignore.
:exit, {:noproc, _} -> nil
:exit, {:noproc, _} ->
Logger.warning(fn -> "trip_modification_publisher: Publishing server not found" end)
nil
end
end

Expand Down

0 comments on commit c2ac232

Please sign in to comment.