From c2ac23284253c60e0a157e3c018070178506f067 Mon Sep 17 00:00:00 2001 From: Hannah Purcell Date: Mon, 3 Feb 2025 20:45:16 -0500 Subject: [PATCH] tweak: Is it valuable to log on trip mod publication success / failure? --- lib/skate_web/controllers/detours_controller.ex | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/skate_web/controllers/detours_controller.ex b/lib/skate_web/controllers/detours_controller.ex index f9a784247..953841c6c 100644 --- a/lib/skate_web/controllers/detours_controller.ex +++ b/lib/skate_web/controllers/detours_controller.ex @@ -1,4 +1,5 @@ defmodule SkateWeb.DetoursController do + require Logger alias Realtime.Shape alias Realtime.TripModification alias Skate.OpenRouteServiceAPI @@ -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