FEATURE: Add ENV to control themes:update errors (#16051)

This commit introduces a new environment variable `RAISE_THEME_ERRORS`
that can control what happens when `theme:update` Rake task errors. It
can have three possible values: `0` to always print errors, `1` to
always raise on error, or be absent to use the default behavior which
raises errors only for default sites.
This commit is contained in:
Dan Ungureanu 2022-02-25 11:54:42 +02:00 committed by GitHub
parent 3e5fb90ce6
commit ae5eab06ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,7 +71,7 @@ def update_themes
raise RemoteTheme::ImportError.new(remote_theme.last_error_text) if remote_theme.last_error_text.present?
rescue => e
STDERR.puts "Failed to update '#{theme.name}': #{e}"
raise if RailsMultisite::ConnectionManagement.current_db == "default"
raise if ENV["RAISE_THEME_ERRORS"] != "0" && (ENV["RAISE_THEME_ERRORS"] == "1" || RailsMultisite::ConnectionManagement.current_db == "default")
end
end