Skip to content

A platform for community discussion. Free, open, simple.

DEV: Better logging of unexpected UC notification error (#41956)

Martin Brennane66d6c56e2c1
diff --git a/app/jobs/scheduled/check_upcoming_changes.rb b/app/jobs/scheduled/check_upcoming_changes.rb
index 1e03b114a27..f6a353e7276 100644
--- a/app/jobs/scheduled/check_upcoming_changes.rb
+++ b/app/jobs/scheduled/check_upcoming_changes.rb
@@ -85,10 +85,12 @@ module Jobs
:error
end
+ backtrace = (status[:backtrace] || status[:result_inspect_steps])&.join("\n") || "N/A"
+
verbose_log(
site,
log_level,
- "Failed to notify about promotion of '#{setting_name}': #{status[:error]} with backtrace: #{status[:backtrace]&.join("\n") || "N/A"}",
+ "Failed to notify about promotion of '#{setting_name}': #{status[:error]} with backtrace: #{backtrace}",
)
end
end
diff --git a/app/services/upcoming_changes/notify_promotions.rb b/app/services/upcoming_changes/notify_promotions.rb
index 3d6140d6a08..9322b25fecc 100644
--- a/app/services/upcoming_changes/notify_promotions.rb
+++ b/app/services/upcoming_changes/notify_promotions.rb
@@ -81,6 +81,14 @@ class UpcomingChanges::NotifyPromotions
end
end
+ if !status_hash[:success] && (!status_hash[:error_key] || !status_hash[:error])
+ status_hash[
+ :error
+ ] = "An unexpected error in UpcomingChanges::NotifyPromotion occurred while notifying about promotion of #{setting_name}"
+ status_hash[:error_key] = :unexpected_error
+ status_hash[:result_inspect_steps] = result.inspect_steps
+ end
+
status_hash
end
end