From 9b829216b259838e9bb896e8364868b81cb67891 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Thu, 25 Apr 2024 12:41:14 +0800 Subject: [PATCH] DEV: Add site's DB name in `themes:update` rake task when printing error (#26749) This is essential for us to determine which site is encountering an error while updating remote themes. We are also including the theme's id because themes can have the same name. --- lib/tasks/themes.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake index e2dc57c762b..6dbdf6c207a 100644 --- a/lib/tasks/themes.rake +++ b/lib/tasks/themes.rake @@ -67,7 +67,9 @@ def update_themes next if remote_theme.blank? || remote_theme.remote_url.blank? print "Checking '#{theme.name}' for '#{RailsMultisite::ConnectionManagement.current_db}'... " + remote_theme.update_remote_version + if remote_theme.out_of_date? puts "updating from #{remote_theme.local_version[0..7]} to #{remote_theme.remote_version[0..7]}" remote_theme.update_from_remote(already_in_transaction: true) @@ -79,7 +81,7 @@ def update_themes raise RemoteTheme::ImportError.new(remote_theme.last_error_text) end rescue => e - STDERR.puts "Failed to update '#{theme.name}': #{e}" + STDERR.puts "[#{RailsMultisite::ConnectionManagement.current_db}] Failed to update '#{theme.name}' (#{theme.id}): #{e}" raise if ENV["RAISE_THEME_ERRORS"] == "1" end end